简体   繁体   中英

Laravel/PHP dd() displays non-structured arrays in Chrome developer tools

I have noticed that writing in Laravel's Controller:

dd($array) 

outputs an un-structured view of array in Chrome Developer Tools (chome 61.0.3163.91 64-bit, 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?

我在官方的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.

Workaround until the bug is fixed.

http_response_code(500);
dd('foo');

Turn it into a helper function ddd

1) Create a file called helpers.php in app/Http

2) Past the following in:

<?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"]

4) Run composer dump-autoload command in terminal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM