php Laravel 5. 调试模式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40691240/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:13:31  来源:igfitidea点击:

Laravel 5. Debug mode

phplaravelconfigdebug-mode

提问by Svetoslav Dimitrov

I set debug mode to truein config->app and deployed it on the server:

我将调试模式设置为truein config->app 并将其部署在服务器上:

'debug' => env('APP_DEBUG', true),

I have following code in Controller to check the mode:

我在控制器中有以下代码来检查模式:

...
$debug = config('app.debug');
var_dump($debug);
$product->save();

Result on local machine:

本地机器上的结果:

C:\xampp\htdocs\MK\app\Http\Controllers\ProductController.php:45:boolean true

C:\xampp\htdocs\MK\app\Http\Controllers\ProductController.php:45:boolean true

Result on the server:

服务器上的结果:

bool(false) Whoops, looks like something went wrong.

bool(false) 哎呀,好像出了点问题。

Why isn't debug mode set on server side?

为什么不在服务器端设置调试模式?

回答by James

This line in your config file, 'debug' => env('APP_DEBUG', true), may be the cause of your issue.

配置文件中的这一行'debug' => env('APP_DEBUG', true)可能是导致问题的原因。

It is saying; set debugto the value defined in my .envfile, and if there is none then use true.

它在说;设置debug为我的.env文件中定义的值,如果没有,则使用true.

As such it is looking at APP_DEBUG=falsein your .envfile, even though you have set the second parameter to true.

因此,它正在查看APP_DEBUG=false您的.env文件,即使您已将第二个参数设置为 true。

Try updating the setting in your .envfile to true.

尝试将.env文件中的设置更新为 true。

回答by Leoben Osamah

In your case, just go to your .envfile and change "APP_DEBUG=false"to "APP_DEBUG=true"

在您的情况下,只需转到您的.env文件并更改"APP_DEBUG=false""APP_DEBUG=true"