作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我将 Laravel 的公共(public)文件夹移动到根文件夹,并将 Laravel 移动到它自己的文件夹。所以我可以在共享主机上使用 Laravel。它看起来像这样:
2015/08/04 18:13 <DIR> .
2015/08/04 18:13 <DIR> ..
2015/08/01 17:50 896 .htaccess
2015/07/29 17:39 0 favicon.ico
2015/07/29 17:39 1,844 index.php
2015/08/04 17:19 <DIR> laravel
2015/08/04 17:20 <DIR> public
2015/08/01 17:46 1,165 README.md
2015/08/01 16:18 34 robots.txt
2015/08/04 17:20 <DIR> static
例如,我使用 public_path()
并得到以下结果:
/htdocs/laravel/public
但我需要的是这个:
/htdocs/public
我检查了 /config/
中的配置文件,但没有任何内容。
请告诉我如何修复它。谢谢
(我的laravel版本是5.0.33)
我覆盖了AppServiceProvider
中的public_path()
$this->app->bind('path.public', function() {
return base_path() . '/';
});
但是什么都没有改变。
最佳答案
您可以通过将其添加到通常位于/public 文件夹中的 index.php 文件来正确绑定(bind)公共(public)文件夹
// set the public path to this directory
$app->bind('path.public', function() {
return __DIR__;
});
You may want to clear your cache after this as the paths may have been cached before. The cached config can be located and deleted manually if you don't have ssh access to the server at
bootstrap/cache/config.php
关于php - 如何在 Laravel 5 中设置基本路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31805814/
我是一名优秀的程序员,十分优秀!