日常调试
function dump($data, $is_exit=true)
{
if (!headers_sent()) {
header("Content-type: text/html; charset=utf-8");
}
echo "<pre>\n";
print_r($data);
echo "\n</pre>\n";
if ($is_exit) exit();
}
跟踪访问来源
function print_stack_trace($bshow=true)
{
$array =debug_backtrace();
//print_r($array);//信息很齐全
unset($array[0]);
foreach($array as $row)
{
$html .=$row['file'].':'.$row['line'].'行,调用方法:'.$row['function']."<p>\r\n";
}
if($bshow)
echo $html."<p>";
return $html;
}
php报乱码
header("Content-Type: text/html;charset=utf-8");