更改Laravel 5.1的公用文件夹 [英] Change the public folder of Laravel 5.1

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

问题描述

我一直在寻找一种方法来更改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.

推荐答案

我按照以下步骤操作,在这里提到:

I followed these steps, mentioned here : https://laracasts.com/discuss/channels/general-discussion/where-do-you-set-public-directory-laravel-5 :

  1. 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的公用文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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