Laravel 5更改public_path() [英] Laravel 5 change public_path()

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

问题描述

我正在尝试将public文件夹移动到其他位置.但是,我找不到修改public_path()变量的地方.现在,"public_path()"返回错误的文件夹路径.

I am trying to move the public folder to other place. However, I can't find the place to modify public_path() variable. Now, the 'public_path()' return the wrong path of folder.

在哪里可以为public_path()设置变量?

Where can I set the variable for public_path()?

推荐答案

您可以使用ioc容器覆盖公共路径:

You can override the public path using ioc container :

对我无懈可击的是在public/index.php中添加了以下三行:

What worked for me flawlessly was adding to public/index.php the following three lines:

 $app->bind('path.public', function() {
    return __DIR__;
});

有关详细说明,请点击此处

这篇关于Laravel 5更改public_path()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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