mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
改进debug类的dump方法
This commit is contained in:
@@ -159,9 +159,10 @@ class Debug
|
|||||||
* @param mixed $var 变量
|
* @param mixed $var 变量
|
||||||
* @param boolean $echo 是否输出 默认为true 如果为false 则返回输出字符串
|
* @param boolean $echo 是否输出 默认为true 如果为false 则返回输出字符串
|
||||||
* @param string $label 标签 默认为空
|
* @param string $label 标签 默认为空
|
||||||
|
* @param integer $flags htmlspecialchars flags
|
||||||
* @return void|string
|
* @return void|string
|
||||||
*/
|
*/
|
||||||
public static function dump($var, $echo = true, $label = null)
|
public static function dump($var, $echo = true, $label = null, $flags = ENT_SUBSTITUTE)
|
||||||
{
|
{
|
||||||
$label = (null === $label) ? '' : rtrim($label) . ':';
|
$label = (null === $label) ? '' : rtrim($label) . ':';
|
||||||
ob_start();
|
ob_start();
|
||||||
@@ -172,7 +173,7 @@ class Debug
|
|||||||
$output = PHP_EOL . $label . $output . PHP_EOL;
|
$output = PHP_EOL . $label . $output . PHP_EOL;
|
||||||
} else {
|
} else {
|
||||||
if (!extension_loaded('xdebug')) {
|
if (!extension_loaded('xdebug')) {
|
||||||
$output = htmlspecialchars($output, ENT_QUOTES);
|
$output = htmlspecialchars($output, $flags);
|
||||||
}
|
}
|
||||||
$output = '<pre>' . $label . $output . '</pre>';
|
$output = '<pre>' . $label . $output . '</pre>';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user