Home >php教程 >php手册 >使用dump函数,给php加断点测试

使用dump函数,给php加断点测试

WBOY
WBOYOriginal
2016-06-06 20:29:351001browse

本篇文章是对使用dump函数,给php加断点测试进行了详细的分析介绍,需要的朋友参考下

复制代码 代码如下:


function dump($var, $echo=true,$label=null, $strict=true)
{
$label = ($label===null) ? '' : rtrim($label) . ' ';
if(!$strict) {
if (ini_get('html_errors')) {
$output = print_r($var, true);
$output = "

".$label.htmlspecialchars($output,ENT_QUOTES)."
";
} else {
$output = $label . " : " . print_r($var, true);
}
}else {
ob_start();
var_dump($var);
$output = ob_get_clean();
if(!extension_loaded('xdebug')) {
$output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);
$output = '
'. $label. htmlspecialchars($output, ENT_QUOTES). '
';
}
}
if ($echo) {
echo($output);
return null;
}else
return $output;
}
,香港虚拟主机,香港服务器,香港虚拟主机
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn