指定其他公共路径 [英] Specify a different public path

查看:67
本文介绍了指定其他公共路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Laravel应用程序可在私有文件夹中运行,我需要告诉Laravel公共路径是不同的. 今天,我已将Laravel应用程序从4.2升级到5.0,但找不到我们指定公共路径的位置因为在Laravel 5.0中不再存在path.php文件.

My Laravel app works in the private folder and I need to tell Laravel that the public path is different. Today I have upgraded a Laravel app from 4.2 to 5.0 and I can't find where we specify the public path since the paths.php file doesn't exist anymore in Laravel 5.0.

在laravel 4.2中,我们有/bootstrap/paths.php文件:

In laravel 4.2 we had the /bootstrap/paths.php file:

/*
|--------------------------------------------------------------------------
| 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文件夹结构,将不胜感激.

I'm not used with the Laravel 5.0 folders structure yet, any help would be greatly appreciated.

推荐答案

对我无懈可击的是在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__;
});

Laracast 中得到了回答

这篇关于指定其他公共路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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