Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将自定义配置文件添加到Laravel 5中的app/config?_Php_Laravel_Laravel 5_Configuration - Fatal编程技术网

Php 如何将自定义配置文件添加到Laravel 5中的app/config?

Php 如何将自定义配置文件添加到Laravel 5中的app/config?,php,laravel,laravel-5,configuration,Php,Laravel,Laravel 5,Configuration,我想将custom_config.php添加到我的Laravel 5项目的app/config目录中,但找不到任何解释此过程的文章。这是如何做到的?您可以轻松地将新文件添加到配置文件夹中。此文件应返回配置值。检查其他配置文件以供参考。比如说constants.php就是这样 <?php return array( 'pagination' => array( 'items_per_page' => 10 ), ); 或 i、 e 我不知

我想将
custom_config.php
添加到我的Laravel 5项目的app/config目录中,但找不到任何解释此过程的文章。这是如何做到的?

您可以轻松地将新文件添加到配置文件夹中。此文件应返回配置值。检查其他配置文件以供参考。比如说
constants.php
就是这样

<?php

return array(
    'pagination' => array(
           'items_per_page' => 10
    ),
);

i、 e


我不知道可能需要创建配置文件多少次,但这里有一个Artisan命令:

我们需要在创建新配置文件后运行
php Artisan config:cache
,否则它不会加载。停止在开发时缓存配置,没有必要
Config::get('constants.pagination.items_per_page');
config('constants.pagination.items_per_page');
config('file_name.variable_name');