Laravel 5在共享主机上-错误的public_path() [英] Laravel 5 on shared hosting - wrong public_path()
问题描述
我将Laravel 5项目部署到了一个共享的托管帐户,将应用程序文件放置在www文件夹之外,仅将公用文件夹放置在www文件夹中.所有人都在这里以最佳答案进行了解释: Laravel 4以及使用FTP部署应用的方式 ...不使用3.,因为Laravel 5中不存在此文件.
I deployed a Laravel 5 project to a shared hosting account, placing the app-files outside of the www-folder, placing only the public folder inside of the www-folder. All like explained here, in the best answer: Laravel 4 and the way to deploy app using FTP... without 3. because this file doesn't exist in Laravel 5.
现在,当我在控制器内调用public_path()时,会得到类似 my-appfiles-outside-of-www /public 而不是 www/公开.有谁知道我为什么在这里没有正确的道路?我可以在某个地方更改它吗? 谢谢!
Now when I call public_path() inside of a controller i get something like my-appfiles-outside-of-www/public instead of www/public. Does anyone know why I doesn't get the right path here? Can I change this somewhere? Thanks!
推荐答案
您可以使用容器覆盖public_path. 示例:
You can override public_path using container. Example:
App::bind('path.public', function() {
return base_path().'/public_html';
});
这篇关于Laravel 5在共享主机上-错误的public_path()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!