/**
* 调试参数中的变量并中断程序的执行,参数可以为任意多个,类型任意,如果参数中含有'debug'参数,刚显示所有的调用过程。
*
* <code>
* debug($var1,$obj1,$array1[,]................);
* debug($var1,'debug');
* </code>
*/
function debug(){
$args = func_get_args();
header('Content-type: text/html; charset=utf-8');
echo "\n<pre class="brush:php;toolbar:false;">---------------------------------debug 调试信息.---------------------------------\n";
foreach($args as $value){
if(is_null($value)){
echo '[is_null]';
}elseif(is_bool($value) || empty ($value)){
var_dump($value);
}else{
print_r($value);
}
echo "\n";
}
$trace = debug_backtrace();
$next = array_merge(
array (
'line' => '??',
'file' => '[internal]',
'class' => null,
'function' => '[main]'
),$trace[0]
);
$dir = realpath(__DIR__);
if(strpos($next['file'], $dir) === 0){
$next['file'] = str_replace($dir, "", $next['file']);
}
echo "\n---------------------------------debug 调试结束.---------------------------------\n\n文件位置:";
echo $next['file'] . "\t第" . $next['line'] . "行."; print_r($trace); } //运行时间 exit; }
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号