如何从我的控制器访问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,
答案 0 :(得分:29)
您可以使用辅助功能配置(Laravel 5 +)。
$debug = config('app.debug');
Laravel 4.2:
$debug = Config::get('app.debug');