laravel 为什么我的调试数据未格式化?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17009465/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why is my debug data unformatted?
提问by krissanawat
var_dump
and print_r
are displayed are not formatted when using Laravel 4. How do I format the data to be more readable?
var_dump
print_r
使用 Laravel 4 时,显示和显示未格式化。如何格式化数据以提高可读性?
回答by Antonio Carlos Ribeiro
Add Kint to your composer.json by running this on the command line:
通过在命令行上运行将 Kint 添加到您的 composer.json:
composer require raveren/kint "dev-master"
And then try it:
然后试试看:
dd( new Controller );
You should see this:
你应该看到这个:
Better, huh?
更好吧?
回答by Krucamper
Use kint
使用kint
we use should s()instead of print_r()
我们使用 should s()而不是print_r()
use should d()instead of var_dump()
使用 should d()而不是var_dump()
ex: sd($arr); like same print_r($arr); die();
例如:sd($arr); 像同样的 print_r($arr); 死();
回答by someone44
You can use the pretag to format align your answear http://www.w3schools.com/tags/tag_pre.asp
您可以使用pre标签来格式化您的 answear http://www.w3schools.com/tags/tag_pre.asp