我想知道是否有人可以阐明为什么laravel应用程序的index.php文件位于公共目录中.如果我改为将其移动到根目录中,会有什么风险?
I was wondering if someone could shed some light as to why the index.php file for a laravel application lives in the public directory. What are the risks if I were to move it into the root directory instead?
推荐答案laravels公用文件夹中的文件和文件夹可以通过Web访问.为了安全起见,laravel框架中的所有其他文件和文件夹都不应通过网络访问.
The files and folders in laravels public folder are meant to be web accessible. For security, all other files and folders in the laravel framework should not be web accessible.
将index.php移至laravels根目录将破坏框架并违反最佳实践.
Moving the index.php to laravels root will break the framework and defy best practices.
按照这些说明进行操作,以确保您的服务器配置指向DocumentRoot的公共目录
Follow these instructions to ensure your servers config points to the public directory for DocumentRoot
更多推荐
Laravel公用文件夹
发布评论