扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
在本页阅读全文(共19页)
function ss_array_as_string (&$array, $column = 0) { $str = "Array(n"; while(list($var, $val) = each($array)){ for ($i = 0; $i < $column+1; $i++){ $str .= "&nbsp;&nbsp;&nbsp;&nbsp;"; } $str .= $var. ==> ; $str .= ss_as_string($val, $column+1)." n"; } for ($i = 0; $i < $column; $i++){ $str .= "&nbsp;&nbsp;&nbsp;&nbsp;"; } return $str.); } function ss_object_as_string (&$object, $column = 0) { if (empty($object->classname)) { return "$object"; } else { $str = $object->classname."( n"; while (list(,$var) = each($object->persistent_slots)) { for ($i = 0; $i < $column; $i++){ $str .= "&nbsp;&nbsp;&nbsp;&nbsp;"; } global $$var; $str .= $var. ==> ; $str .= ss_as_string($$var, column+1)." n"; } for ($i = 0; $i < $column; $i++){ $str .= "&nbsp;&nbsp;&nbsp;&nbsp;"; } return $str.); } } function ss_as_string (&$thing, $column = 0) { if (is_object($thing)) { return ss_object_as_string($thing, $column); } elseif (is_array($thing)) { return ss_array_as_string($thing, $column); } elseif (is_double($thing)) { return "Double(".$thing.")"; } elseif (is_long($thing)) { return "Long(".$thing.")"; } elseif (is_string($thing)) { return "String(".$thing.")"; } else { return "Unknown(".$thing.")"; } } |
echo ss_as_string($my_variable); |
echo ss_as_string($GLOBALS); |
$ss_log_level = 0; $ss_log_filename = /tmp/ss-log; $ss_log_levels = array( NONE => 0, ERROR => 1, INFO => 2, DEBUG => 3); function ss_log_set_level ($level = ERROR) { global $ss_log_level; $ss_log_level = $level; } function ss_log ($level, $message) { global $ss_log_level, $ss-log-filename; if ($ss_log_levels[$ss_log_level] < $ss_log_levels[$level]) { // 不显示Log信息 return false; } $fd = fopen($ss_log_filename, "a+"); fputs($fd, $level. - [.ss_timestamp_pretty().] - .$message."n"); fclose($fd); return true; } function ss_log_reset () { global $ss_log_filename; @unlink($ss_log_filename); } |
ss_log(ERROR, "testing level ERROR"); ss_log(INFO, "testing level INFO"); ss_log(DEBUG, "testing level DEBUG"); |
function ss_timing_start ($name = default) { global $ss_timing_start_times; $ss_timing_start_times[$name] = explode( , microtime()); } function ss_timing_stop ($name = default) { global $ss_timing_stop_times; $ss_timing_stop_times[$name] = explode(, microtime()); } function ss_timing_current ($name = default) { global $ss_timing_start_times, $ss_timing_stop_times; if (!isset($ss_timing_start_times[$name])) { return 0; } if (!isset($ss_timing_stop_times[$name])) { $stop_time = explode(, microtime()); } else { $stop_time = $ss_timing_stop_times[$name]; } $current = $stop_time[1] - $ss_timing_start_times[$name][1]; $current += $stop_time[0] - $ss_timing_start_times[$name][0]; return $current; } |
function query($Query_String, $halt_on_error = 1) { $this->connect(); ss_timing_start(); $this->Query_ID = @mysql_query($Query_String,$this->Link_ID); ss_timing_stop(); ss_log(INFO, ss_timing_current(). Secs - .$Query_String); $this->Row = 0; $this->Errno = mysql_errno(); $this->Error = mysql_error(); if ($halt_on_error && !$this->Query_ID) { $this->halt("Invalid SQL: ".$Query_String); } return $this->Query_ID; } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者