我一直在寻找一种方法来更改laravel 5.1中公共文件夹的名称,因为主机只允许我使用htdocs文件夹.
I was looking for a way to change the public's folder name in laravel 5.1, since my host only allows me to use a htdocs folder.
推荐答案我按照以下步骤操作,在这里提到: laracasts/discuss/channels/general-discussion/where-do-you-set-public-directory-laravel-5 :
I followed these steps, mentioned here : laracasts/discuss/channels/general-discussion/where-do-you-set-public-directory-laravel-5 :
在bootstrap/app.php中,添加 $app->bind('path.public', function() { return base_path('htdocs'); });
然后在/server.php中,将public的两次出现更改为htdocs(或您要使用的任何内容).
Then, in /server.php, change the two occurences of publicto htdocs (Or whatever you wan to use).
我衷心希望在任何情况下都能奏效.
I sincerely hope that'll work in every situation.
我最近不得不做同样的事情,但是这次我的主机允许我删除"htdocs"文件夹(并且我具有ssh访问权限):
I recently had to do the same, but this time my host allowed me to delete the "htdocs" folder (And I had a ssh access) :
- 我将Laravel安装在"htdocs"文件夹下方的根文件夹中
- 我删除了"htdocs"文件夹
- 我创建了一个符号链接,将"htdocs"映射到"public":ln -s public htdocs
更多推荐
更改Laravel 5.1的公用文件夹
发布评论