问题描述
我具有以下文件夹结构.
I have the following folder structure.
src/
|- index.php
test/
vendor/
composer.json
composer.lock
当我想部署我的代码时,我意识到我必须将src/目录映射到文档根目录,因为它包含index.php文件(其中btw包含一些Restler代码)但是,如果这样做,我该如何处理文档根目录之外的供应商/文件夹?
When i want to deploy my code, I realize that i have to map the src/ directory to document root since it contains the index.php file (which btw contains some Restler code)However, if i do that, how do i deal with the vendor/ folder that lies outside the document root?
推荐答案
供应商文件夹必须位于网络根目录之外,以提高安全性
vendor folder MUST be outside of the web root for better security
包括autoload.php
或restler.php
时,它将使那些类(位于供应商文件夹中)可用
When you include autoload.php
or restler.php
, it will take care of making those classes (residing in vendor folder) available
理想情况下,您应该将index.php保留在名为public
的文件夹中,并使用src
文件夹保留自己的代码
Ideally you should keep your index.php in a folder named public
and use src
folder for keeping your own code
这篇关于Composer-将src目录映射到外部供应商文件夹位于文档根目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!