lumen 使用 laravel-cors 的时候, 使用 dd 函数的解决方法

 

if (! function_exists('dd')) {
    /**
     * Dump the passed variables and end the script.
     *
     * @param  mixed  $args
     * @return void
     */
    function dd(...$args)
    {
        header('Access-Control-Allow-Origin: *');
        header('Access-Control-Allow-Methods: *');
        header('Access-Control-Allow-Headers: *');
        http_response_code(500);

        foreach ($args as $x) {
            (new Illuminate\Support\Debug\Dumper)->dump($x);
        }

        die(1);
    }
}

  

posted @ 2018-12-14 22:13  佚名000  阅读(436)  评论(0编辑  收藏  举报