laravel 如何在 Laravel5 中更改视图文件夹?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28848008/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 11:03:45  来源:igfitidea点击:

How change view folder in Laravel5?

phpangularjslaravellaravel-5

提问by gsk

I am developing an web application using Laravel 5 and AngularJS. I am using pure angularJS app for the client side and I am putting the client app files (views) in my publicfolder.

我正在使用 Laravel 5 和 AngularJS 开发一个 Web 应用程序。我在客户端使用纯 angularJS 应用程序,并将客户端应用程序文件(视图)放在我的public文件夹中。

In Laravel 4, I could change the path from the bootstrap/start.phpfile. But in Laravel 5, I can not see the start.phpfile. So where do I change the configuration in Laravel 5?

在 Laravel 4 中,我可以更改bootstrap/start.php文件中的路径。但是在 Laravel 5 中,我看不到该start.php文件。那么我在哪里更改 Laravel 5 中的配置?

回答by Andy Fleming

See line 16 of config/view.php(the "View Storage Paths" section)

请参阅第 16 行config/view.php(“查看存储路径”部分)

'paths' => [
    realpath(base_path('resources/views'))
],

So you might change it to realpath(base_path('public/assets/views'))to be in your public path.

因此,您可以将其更改realpath(base_path('public/assets/views'))为在您的公共路径中。



Additional Examples

其他示例

'paths' => [

    // src/MyNamespace/resources
    realpath(base_path('src/MyNamespace/resources')),

    // app/resources
    realpath(app_path('resources'))

],
  • You can provide multiple search locations
  • You can use app_path(), base_path(), or neither.
  • 您可以提供多个搜索位置
  • 您可以使用app_path()base_path()或两者都不是。