Laravel 4-如何获得有意义的错误


Laravel 4 - how to get meaningful errors

这是我第一次在Windows机器上进行本地开发。在MAMP上,我曾经收到过有意义的错误消息,但下面的代码给了我无法破译的错误。

$user = User::find(10);
Auth::login($user);

异常处理程序中出现错误:array_merge():参数#2不是/home/warrant/Code/projectname/vender/laravel/framework/src/IIlluminate/View/Environment.php中的数组:117

我如何获得默认的"橙色"laravel错误页面,为什么这种简单的身份验证不起作用?

可能是您的环境设置不正确。

尝试在terminal.app 中键入以下内容

 hostname

这将为您的机器提供主机名,复制并粘贴到detectEnvironment()函数中的''bootstrap''start.php中。

/*
|--------------------------------------------------------------------------
| Detect The Application Environment
|--------------------------------------------------------------------------
|
| Laravel takes a dead simple approach to your application environments
| so you can just specify a machine name for the host that matches a
| given environment, then we will automatically detect it for you.
|
*/
$env = $app->detectEnvironment(array(
    'local' => array('homestead'),
));

将字符串'homest'替换为您的主机名。希望这能让你找回你的错误。