我如何从控制器访问app/config/app.php
中的调试变量以查看我是否处于调试模式?
<?php
|
/* | if ( $this->user->id )
|-------------------------------------------------------------------------- | {
| Application Debug Mode | // Save roles. Handles updating.
|-------------------------------------------------------------------------- | $this->user->saveRoles(Input::get( 'roles' ));
| |
| When your application is in debug mode, detailed error messages with | // Redirect to the new user page
| stack traces will be shown on every error that occurs within your | return Redirect::to('admin/users/'.$this->user->id)->with('success', Lang::get('admin/users/messages.cre
| application. If disabled, a simple generic error page is shown. |ate.success'));
| | }
*/ | else
| {
'debug' => true,
您可以使用助手函数config (Laravel 5+)
$debug = config('app.debug');
Laravel 4.2:
$debug = Config::get('app.debug');
这个问题已经有了正确的答案,我只是想补充一下,用环境变量来做是一个更好的选择:
'debug' => env('APP_DEBUG', false),
在。env文件中:
APP_ENV=local