为了账号安全,请及时绑定邮箱和手机立即绑定

laravel 线上环境 api接口,出错信息全通过json暴露出来了,如何屏蔽

laravel 线上环境 api接口,出错信息全通过json暴露出来了,如何屏蔽

PHP
叮当猫咪 2019-03-10 00:24:11
laravel 线上环境 api接口,出错信息全通过json暴露出来了,如何屏蔽 .env 文件设置如下APP_ENV=productionAPP_DEBUG=false { "error":500, "data":"Undefined index: list_code", "trace":[ { "file":"/data/www.baidu.com/app/Http/Controllers/API/WWWController.php", "line":142, "function":"handleError", "class":"Illuminate\Foundation\Bootstrap\HandleExceptions", "type":"->", "args":[ 8, "Undefined index: xm_list_code", "/data/www.baidu.com/app/Http/Controllers/API/WWWController.php", 142, { "request":{ "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, "params":{ }, "result":{ "resultCode":0, "resultMessage":"successful" } } ] }, { "function":"loanSuccess", "class":"App\Http\Controllers\API\WWWController", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9425, "function":"call_user_func_array", "args":[ [ { }, "loanSuccess" ], [ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9487, "function":"callAction", "class":"Illuminate\Routing\Controller", "type":"->", "args":[ "loanSuccess", [ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9467, "function":"call", "class":"Illuminate\Routing\ControllerDispatcher", "type":"->", "args":[ { }, { }, "loanSuccess" ] }, { "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\ControllerDispatcher", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":52, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9950, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9468, "function":"then", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9455, "function":"callWithinStack", "class":"Illuminate\Routing\ControllerDispatcher", "type":"->", "args":[ { }, { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, "loanSuccess" ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":8525, "function":"dispatch", "class":"Illuminate\Routing\ControllerDispatcher", "type":"->", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, "App\Http\Controllers\API\WWWController", "loanSuccess" ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":8512, "function":"runController", "class":"Illuminate\Routing\Route", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":8226, "function":"run", "class":"Illuminate\Routing\Route", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Router", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":52, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php", "line":48, "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"handle", "class":"Illuminate\Routing\Middleware\ThrottleRequests", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { }, "60", "1" ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9965, "function":"call_user_func_array", "args":[ [ { }, "handle" ], [ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { }, "60", "1" ] ] }, { "function":"Illuminate\Pipeline\{closure}", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":32, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/app/Http/Middleware/API.php", "line":24, "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"handle", "class":"App\Http\Middleware\API", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9965, "function":"call_user_func_array", "args":[ [ { }, "handle" ], [ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] ] }, { "function":"Illuminate\Pipeline\{closure}", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":32, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/app/Http/Middleware/LocaleMiddleware.php", "line":48, "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"handle", "class":"App\Http\Middleware\LocaleMiddleware", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9965, "function":"call_user_func_array", "args":[ [ { }, "handle" ], [ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] ] }, { "function":"Illuminate\Pipeline\{closure}", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":32, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":11956, "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"handle", "class":"Illuminate\Session\Middleware\StartSession", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9965, "function":"call_user_func_array", "args":[ [ { }, "handle" ], [ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] ] }, { "function":"Illuminate\Pipeline\{closure}", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":32, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":13202, "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"handle", "class":"Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9965, "function":"call_user_func_array", "args":[ [ { }, "handle" ], [ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] ] }, { "function":"Illuminate\Pipeline\{closure}", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":32, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":13139, "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"handle", "class":"Illuminate\Cookie\Middleware\EncryptCookies", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9965, "function":"call_user_func_array", "args":[ [ { }, "handle" ], [ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] ] }, { "function":"Illuminate\Pipeline\{closure}", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":32, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9950, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":8227, "function":"then", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":8218, "function":"runRouteWithinStack", "class":"Illuminate\Routing\Router", "type":"->", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":8208, "function":"dispatchToRoute", "class":"Illuminate\Routing\Router", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":2419, "function":"dispatch", "class":"Illuminate\Routing\Router", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"Illuminate\Foundation\Http\{closure}", "class":"Illuminate\Foundation\Http\Kernel", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":52, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/app/Http/Middleware/WapAPIVerifyCsrfToken.php", "line":28, "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"handle", "class":"App\Http\Middleware\WapAPIVerifyCsrfToken", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9965, "function":"call_user_func_array", "args":[ [ { }, "handle" ], [ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] ] }, { "function":"Illuminate\Pipeline\{closure}", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":32, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/anlutro/l4-settings/src/SaveMiddleware.php", "line":45, "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"handle", "class":"anlutro\LaravelSettings\SaveMiddleware", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9965, "function":"call_user_func_array", "args":[ [ { "settings":{ "files":{ }, "path":"/data/www.baidu.com/storage/settings.json" } }, "handle" ], [ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] ] }, { "function":"Illuminate\Pipeline\{closure}", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":32, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":3286, "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"handle", "class":"Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9965, "function":"call_user_func_array", "args":[ [ { }, "handle" ], [ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } }, { } ] ] }, { "function":"Illuminate\Pipeline\{closure}", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line":32, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "function":"Illuminate\Routing\{closure}", "class":"Illuminate\Routing\Pipeline", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":9950, "function":"call_user_func", "args":[ { }, { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":2366, "function":"then", "class":"Illuminate\Pipeline\Pipeline", "type":"->", "args":[ { } ] }, { "file":"/data/www.baidu.com/bootstrap/cache/compiled.php", "line":2350, "function":"sendRequestThroughRouter", "class":"Illuminate\Foundation\Http\Kernel", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] }, { "file":"/data/www.baidu.com/public/index.php", "line":55, "function":"handle", "class":"Illuminate\Foundation\Http\Kernel", "type":"->", "args":[ { "attributes":{ }, "request":{ }, "query":{ }, "server":{ }, "files":{ }, "cookies":{ }, "headers":{ } } ] } ] }
查看完整描述

4 回答

?
小唯快跑啊

TA贡献1863条经验 获得超2个赞

先说一点,凡是上线的项目,请务必

# .env 文件
APP_DEBUG=false
查看完整回答
反对 回复 2019-03-18
?
达令说

TA贡献1821条经验 获得超6个赞

php.ini

display_errors = Off;

查看完整回答
反对 回复 2019-03-18
?
慕娘9325324

TA贡献1783条经验 获得超4个赞

如果你是用的 dingo/api 请再看下 API_DEBUG=false

查看完整回答
反对 回复 2019-03-18
?
狐的传说

TA贡献1804条经验 获得超3个赞

try...catch 捕获报错信息,把错误信息记录到日志中。api吐出的可以是自定的错误信息

查看完整回答
反对 回复 2019-03-18
  • 4 回答
  • 0 关注
  • 623 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信