码迷,mamicode.com
首页 > 编程语言 > 详细

PHP 重新格式化var_dump/print_r打印的数组

时间:2018-04-02 16:02:56      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:bsp   nbsp   格式化   print   get   spec   return   gpo   span   

// 在使用var_dump/print_r时   打印出来的数组 都是一行显示的, 看起来不方便


function
dump($vars, $label = ‘‘, $return = false) { if (ini_get(‘html_errors‘)) { $content = "<pre>\n"; if ($label != ‘‘) { $content .= "<strong>{$label} :</strong>\n"; } $content .= htmlspecialchars(print_r($vars, true)); $content .= "\n</pre>\n"; } else { $content = $label . " :\n" . print_r($vars, true); } if ($return) { return $content; } echo $content; return null; }

 

PHP 重新格式化var_dump/print_r打印的数组

标签:bsp   nbsp   格式化   print   get   spec   return   gpo   span   

原文地址:https://www.cnblogs.com/arvin-an/p/8693617.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!