Home  >  Article  >  PHP Framework  >  Solution to thinkphp 5 error display nginx 404 page

Solution to thinkphp 5 error display nginx 404 page

藏色散人
藏色散人forward
2021-07-03 15:12:342824browse

Solution to thinkphp 5 error display nginx 404 page

thinkphp 5 The error message displays the nginx 404 page

I deployed the project online today, but the error message appears, but the nginx 404 page is always displayed. , if it continues like this, the problem cannot be solved. I looked at thinkphp's log file online:

[ sql ] [ SQL ] SELECT `data_id`,`pid` FROM `tb_data_manage` WHERE  `pid` IN (53,49,47,46,35) [ RunTime:0.000595s ]
[ error ] [8]未定义数组索引: see[/data/web/data_manage/runtime/temp/5e9fc553d7acc7eaa186b674b2a29538.php:143]

Obviously, it is PHP that has an error, not nginx that cannot find the page, and nginx's pathinfo There is no problem with the settings. I also set app_debug in config.php to true, so I searched for solutions online. The final solution was to open the file think_exception.tpl under thinkphp/tpl at the end of the php file. Add an exit

        })();
    </script>
    <?php } exit; ?>
</body>
</html>

to the tag and the problem will be solved. If you access the browser again, 404 will no longer be displayed and the thinkphp error page will appear.

Related recommendations: The latest 10 thinkphp video tutorials

The above is the detailed content of Solution to thinkphp 5 error display nginx 404 page. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete