使用tp6开发时,不提示具体错误,只返回 Internal Server Error,500 error
添加入下代码
ini_set("display_errors","On");
error_reporting(E_ALL);
可放到入口文件, /public/index.php
<?php
// [ 应用入口文件 ]
namespace think;
require __DIR__ . '/../vendor/autoload.php';
// 执行HTTP应用并响应
$http = (new App())->http;
$response = $http->run();
// 开启debug才展示
if(env('APP_DEBUG')){
ini_set("display_errors","On");
error_reporting(E_ALL);
}
$response->send();
$http->end($response);
《完》
在使用ThinkPHP6(简称tp6)进行开发时,遇到不显示具体错误,仅返回InternalServerError500错误的情况。为了解决这个问题,可以在入口文件/public/index.php中设置`ini_set(display_errors,On);`和`error_reporting(E_ALL);`来开启错误显示,特别是当APP_DEBUG环境变量为真时。通过这些设置,开发者可以获取到详细的错误信息以便于调试。
1370

被折叠的 条评论
为什么被折叠?



