由于公司的开发机没有开xdebug拓展,导致var_dump()在浏览器上看很不方便。

因此,加入从thinkphp搬过来的dump()函数。

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 = "<pre>" . $label . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
} 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 = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>';
}
}
if ($echo) {
echo($output);
return null;
}else
return $output;
}

最新文章

  1. FreeRTOS学习及移植笔记之一:开始FreeRTOS之旅
  2. java-集合4
  3. Screensiz.es – 最流行移动设备及显示器的屏幕规格大全
  4. 使用Texture2D创建Cubemap
  5. CentOS 7.x安装配置
  6. 【Struts2学习笔记-3】常量配置
  7. BZOJ 4571 美味
  8. 创建对象_原型(Prototype)模式_深拷贝
  9. UVa 437 (变形的LIS) The Tower of Babylon
  10. java properties 文件中书写相对路径
  11. Java获取 JVM 运行信息
  12. 《生活在Linux中》之:prefer function to alias in Bash
  13. JAVA_file(1)
  14. SQL Server-聚焦存储过程性能优化、数据压缩和页压缩提高IO性能(一)
  15. centos6.8安装JDK
  16. Qt 出现“undefined reference to `vtable for”
  17. Android Studio &amp; HTTP Proxy
  18. 启动Azure模拟器出错解决方案
  19. nodeJs实现微信小程序的图片上传
  20. screen 命令 http://man.linuxde.net/screen

热门文章

  1. Python基础笔记_Number类型
  2. springMVC项目创建及导入包项
  3. webpack 清理旧打包资源插件
  4. vue2 + koa2全栈部署
  5. Docker系列(十一):Kubernetes集群集群部署实践
  6. 《DSP using MATLAB》Problem 8.28
  7. sprignboot 中thymeleaf和freemarker 都存在时,默认选择哪个
  8. elasticsearch filters特性
  9. elasticsearch 中文API bulk(六)
  10. SyntaxError: Non-ASCII character ‘xe5’ in file 04.py on line 4, but no encoding declared