我想与使用dd()进行调试的人共享实时保护程序,并且每次都要刷新,因为它的状态为200并卡住了。
答案 0 :(得分:0)
项目/供应商/symfony/var-dumper/Dumper/HtmlDumper.php
第111行的类,其中存在dump()方法。
只需在函数开头添加行http_response_code(500);
。它适用于Laravel 5.6版本。
答案 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}}