Laravel公用文件夹 [英] Laravel Public Folder

查看:60
本文介绍了Laravel公用文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以阐明为什么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公用文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆