[英]Laravel/PHP dd() displays non-structured arrays in Chrome developer tools
I have noticed that writing in Laravel's Controller: 我注意到在Laravel的Controller中编写的内容:
dd($array)
outputs an un-structured view of array in Chrome Developer Tools (chome 61.0.3163.91 64-bit, MAC OS). 在Chrome开发者工具(64位chome 61.0.3163.91,MAC OS)中输出数组的非结构化视图。
before it was something like this (at least it seems to me that it was like this): 之前是这样的(至少在我看来,是这样的):
Do I have 'false memories'? 我有“错误的记忆”吗?
OR, if dd() really outputted structured arrays in devtools, how do I bring it back? 或者,如果dd()确实在devtools中输出了结构化数组,如何将其带回来?
我在官方的chrome bug论坛https://bugs.chromium.org/p/chromium/issues/detail?id=767386#c5上发布了相同的问题,他们说将在17- 2017年10月,今天...今天:)
I'm using Chrome Version 63.0.3239.132 (Official Build) (64-bit) and still have the issue. 我使用的是Chrome版本63.0.3239.132(正式版本)(64位),仍然有问题。
Workaround until the bug is fixed. 解决此问题,直到修复该错误。
http_response_code(500);
dd('foo');
Turn it into a helper function ddd
将其转换为辅助功能 ddd
1) Create a file called helpers.php
in app/Http
1)在app/Http
创建一个名为helpers.php
的文件
2) Past the following in: 2)将以下内容输入:
<?php
function ddd(...$args){
http_response_code(500);
call_user_func_array('dd', $args);
}
3) In composer.json
, in the autoload
section, add "files": ["app/Http/helpers.php"]
3)在composer.json
的autoload
部分中,添加"files": ["app/Http/helpers.php"]
4) Run composer dump-autoload
command in terminal 4)在终端中运行composer dump-autoload
命令
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.