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

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

WBOY
Release: 2016-06-06 20:29:35
Original
1023 people have browsed it

本篇文章是对使用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)."
Copy after login
";
} 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). '
Copy after login
';
}
}
if ($echo) {
echo($output);
return null;
}else
return $output;
}
,香港虚拟主机,香港服务器,香港虚拟主机
Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template