Laravel 在输出中显示所有刀片代码

时间:2021-06-17 04:57:23

标签: php laravel

当我直接从 URL 请求刀片文件时,它会显示所有刀片代码,即使用户未通过身份验证!
我该如何处理?或者如何阻止直接执行刀片文件?

enter image description here

1 个答案:

答案 0 :(得分:0)

您的 Laravel 应用程序似乎已添加到您的网络服务器的文档根目录中。您应该无法直接在浏览器中访问该文件。

您的文档根目录应设置为 Laravel 项目文件夹内的 public/ 文件夹,使 index.php 成为您应用程序的唯一访问点。

有关详细信息,请参阅 https://laravel.com/docs/8.x/deployment#server-configurationhttps://laravel.com/docs/8.x/structure#the-public-directory

相关问题