【发布时间】:2016-06-30 21:16:51
【问题描述】:
我的 Laravel 应用程序在私有文件夹中运行,我需要告诉 Laravel 公共路径不同。 今天我将一个 Laravel 应用从 4.2 升级到 5.0,我找不到我们在哪里指定公共路径 since the paths.php file doesn't exist anymore in Laravel 5.0。
在 laravel 4.2 中,我们有 /bootstrap/paths.php 文件:
/*
|--------------------------------------------------------------------------
| Public Path
|--------------------------------------------------------------------------
|
| The public path contains the assets for your web application, such as
| your JavaScript and CSS files, and also contains the primary entry
| point for web requests into these applications from the outside.
|
*/
'public' => __DIR__.'/../../../public_html',
我还没有使用 Laravel 5.0 文件夹结构,任何帮助将不胜感激。
【问题讨论】:
-
您可以尝试制作自己的 Helper 类,并根据您的喜好覆盖
public_path函数并重命名公共 fulder -
你能举个例子吗?这个解决方案看起来有点棘手,我一直认为 Laravel 已经为每种类型的托管环境而构建,如果不再是这种情况,那将是令人失望的。
-
最佳解决方案是选定的答案。请花一点时间阅读它及其 cmets,并尽量不要让无用的类使您的应用超载。
-
您能说得更具体些吗?它应该适用于每个不同的文件夹结构,因为 $app 是在绝对路径中定义的。
标签: laravel-5