Chrome的新版本无法在网络预览窗口Laravel中呈现dd功能

时间:2018-08-10 11:48:29

标签: laravel

我想与使用dd()进行调试的人共享实时保护程序,并且每次都要刷新,因为它的状态为200并卡住了。

2 个答案:

答案 0 :(得分:0)

enter image description here如果要将ajax请求的状态更改为500,则只需更新

项目/供应商/symfony/var-dumper/Dumper/HtmlDumper.php 第111行的类,其中存在dump()方法。 只需在函数开头添加行http_response_code(500);。它适用于Laravel 5.6版本。

我在https://github.com/laravel/framework/issues/21808

中找到的答案

答案 1 :(得分:0)

在以下位置查看我的解决方案

https://gist.github.com/fontenele/7625cb71c0a8356213abc727278b48d5

我创建了一个新的帮助器,获取内容,将div替换为span,因为google在DevTools中不允许使用use Illuminate\Support\Debug\Dumper; if (!function_exists('_dd')) { function _dd(...$args) { $content = '<span>'; ob_start(); foreach ($args as $x) { (new Dumper)->dump($x); } $content .= ob_get_contents(); ob_end_clean(); $content.= '</span>'; $content = str_replace(['<div', '</div>'], ['<span', '</span>'], $content); response()->make($content, 500, ['Content-Type' => 'text/html'])->send(); die(1); } } 标签。

function _dd(...$args)
    {
        $content = '<span>';
        ob_start();
        dump(...$args);
        $content .= ob_get_contents();
        ob_end_clean();
        $content .= '</span>';
        $content = str_replace(['<div', '</div>'], ['<span', '</span>'], $content);
        response()->make($content, 500, ['Content-Type' => 'text/html'])->send();
        die(1);
    }

已更新 流明:

{{1}}