Why is my debug data unformatted?

2020-07-18 09:23发布

var_dump and print_r are displayed are not formatted when using Laravel 4. How do I format the data to be more readable?

3条回答
老娘就宠你
2楼-- · 2020-07-18 09:48

Add Kint to your composer.json by running this on the command line:

composer require raveren/kint "dev-master"

And then try it:

dd( new Controller );

You should see this:

enter image description here

Better, huh?

查看更多
Melony?
3楼-- · 2020-07-18 09:58

You can use the pre tag to format align your answear http://www.w3schools.com/tags/tag_pre.asp

查看更多
我欲成王,谁敢阻挡
4楼-- · 2020-07-18 10:01

Use kint

we use should s() instead of print_r()

use should d() instead of var_dump()

ex: sd($arr); like same print_r($arr); die();

Ref: http://raveren.github.io/kint/#configuration

查看更多
登录 后发表回答