当前位置: 首页 > news >正文

wordpress自定义分类分页武汉seo楚天

wordpress自定义分类分页,武汉seo楚天,网站建设贵州,江西网站建设哪家公司好介绍 Laravel 框架的所有配置文件都保存在 config 目录中。每个选项都有说明,你可随时查看这些文件并熟悉都有哪些配置选项可供你使用。 使用 您可以在应用程序的任何位置使用全局 config 辅助函数轻松访问配置值。 可以使用“点”语法访问配置值,其中…

介绍

Laravel 框架的所有配置文件都保存在 config 目录中。每个选项都有说明,你可随时查看这些文件并熟悉都有哪些配置选项可供你使用。

使用

您可以在应用程序的任何位置使用全局 config 辅助函数轻松访问配置值。 可以使用“点”语法访问配置值,其中包括您希望访问的文件名和选项。 也可以指定默认值,如果配置选项不存在,将返回:

$value = config('app.timezone');// 如果配置值不存在,则检索默认值...
$value = config('app.timezone', 'Asia/Seoul');

使用分析

我们可以先看一下助手函数 config

if (! function_exists('config')) {/*** Get / set the specified configuration value.** If an array is passed as the key, we will assume you want to set an array of values.** @param  array|string|null  $key* @param  mixed  $default* @return mixed*/function config($key = null, $default = null){if (is_null($key)) {return app('config');}if (is_array($key)) {return app('config')->set($key);}return app('config')->get($key, $default);}
}

分析

app(‘config’) 是注册到服务容器的实例,这里我们追踪到config 的实例是

Illuminate\Contracts\Config\Repository

Repository 的 set & get 方法代码如下

    /*** Set a given configuration value.** @param  array|string  $key* @param  mixed  $value* @return void*/public function set($key, $value = null){$keys = is_array($key) ? $key : [$key => $value];foreach ($keys as $key => $value) {Arr::set($this->items, $key, $value);}}/*** Get the specified configuration value.** @param  array|string  $key* @param  mixed  $default* @return mixed*/public function get($key, $default = null){if (is_array($key)) {return $this->getMany($key);}return Arr::get($this->items, $key, $default);}

这时我们就可以清晰的知道,助手函数config($key = null, $default = null)的含义:

  • 如果$key 不传或者传null,返回的是注册到服务容器中Repository实例
  • 如果$key 为数组,那么修改Repository 的 items的值
  • 其他情况 返回 Repository 的 items[$key] ?? $default

  • 此时我们就可能有疑问 Repositiry 中 items 值是什么时候进行赋值的呢?赋的值又是那些呢?接下来我们一点点的分析

    绑定服务容器

    在laravel运行中,并没有直接绑定 Repositiry 到容器中,而是第一次构建config实例的时候进行了绑定,app(‘config’) 或者 app()->make(‘config’) 时检测是否进行绑定,如果没有的话进行绑定,下面时make函数:

        /*** Resolve the given type from the container.** @param  string  $abstract* @param  array  $parameters* @return mixed*/public function make($abstract, array $parameters = []){$abstract = $this->getAlias($abstract);if (! $this->bound($abstract) &&array_key_exists($abstract, $this->availableBindings) &&! array_key_exists($this->availableBindings[$abstract], $this->ranServiceBinders)) {$this->{$method = $this->availableBindings[$abstract]}();$this->ranServiceBinders[$method] = true;}return parent::make($abstract, $parameters);}
    

    根据代码可知

    $this->availableBindings['config'] = registerConfigBindings
    

    registerConfigBindings函数即为绑定到容器方法

        /*** Register container bindings for the application.** @return void*/protected function registerConfigBindings(){$this->singleton('config', function () {return new ConfigRepository;});}
    

    因此在调用make(‘config’) 时若没有绑定,自动调用registerConfigBindings方法进行绑定

    配置文件赋值

    在bootstrap/app.php中,进行对配置文件进行了赋值,譬如:

    $app->configure('auth');
    $app->configure('permission');
    $app->configure('excel');
    $app->configure('database');
    

    configure函数为:

        /*** Load a configuration file into the application.** @param  string  $name* @return void*/public function configure($name){if (isset($this->loadedConfigurations[$name])) {return;}$this->loadedConfigurations[$name] = true;$path = $this->getConfigurationPath($name);if ($path) {$this->make('config')->set($name, require $path);}}
    

    这里的操作就是将conf/$name.conf 的内容写到 Repositiry 中 items 值中


文章转载自:
http://veratric.fznj.cn
http://bsn.fznj.cn
http://tapi.fznj.cn
http://sharper.fznj.cn
http://integrative.fznj.cn
http://unrighteousness.fznj.cn
http://dichromatic.fznj.cn
http://tokushima.fznj.cn
http://intellectually.fznj.cn
http://spray.fznj.cn
http://irkutsk.fznj.cn
http://guiltiness.fznj.cn
http://cataphoric.fznj.cn
http://womenfolk.fznj.cn
http://contraband.fznj.cn
http://bareboat.fznj.cn
http://decoloration.fznj.cn
http://flocculence.fznj.cn
http://sapodilla.fznj.cn
http://infobahn.fznj.cn
http://affront.fznj.cn
http://toxigenesis.fznj.cn
http://thornlike.fznj.cn
http://demulsify.fznj.cn
http://sublunary.fznj.cn
http://strongyloidiasis.fznj.cn
http://panful.fznj.cn
http://gameland.fznj.cn
http://mouthy.fznj.cn
http://ponderability.fznj.cn
http://sorcerer.fznj.cn
http://astropologist.fznj.cn
http://gph.fznj.cn
http://redux.fznj.cn
http://willow.fznj.cn
http://cerated.fznj.cn
http://endopsychic.fznj.cn
http://intima.fznj.cn
http://profitably.fznj.cn
http://coincident.fznj.cn
http://floatplane.fznj.cn
http://roweite.fznj.cn
http://kasbah.fznj.cn
http://dermatography.fznj.cn
http://aeroneer.fznj.cn
http://noiseful.fznj.cn
http://coquilla.fznj.cn
http://omenta.fznj.cn
http://sniveler.fznj.cn
http://timberyard.fznj.cn
http://adoringly.fznj.cn
http://aerometer.fznj.cn
http://malam.fznj.cn
http://lur.fznj.cn
http://voivodina.fznj.cn
http://peristylium.fznj.cn
http://telecommand.fznj.cn
http://weeknight.fznj.cn
http://hy.fznj.cn
http://pasta.fznj.cn
http://sprite.fznj.cn
http://subvene.fznj.cn
http://calamiform.fznj.cn
http://haemorrhage.fznj.cn
http://saucer.fznj.cn
http://rotatory.fznj.cn
http://dacker.fznj.cn
http://grecian.fznj.cn
http://warpath.fznj.cn
http://whirlaway.fznj.cn
http://remediless.fznj.cn
http://sparrow.fznj.cn
http://fervidor.fznj.cn
http://stiff.fznj.cn
http://ckd.fznj.cn
http://holoparasite.fznj.cn
http://caravaner.fznj.cn
http://winterthur.fznj.cn
http://legend.fznj.cn
http://acariasis.fznj.cn
http://tenable.fznj.cn
http://isostemony.fznj.cn
http://adhesion.fznj.cn
http://disapprovingly.fznj.cn
http://trivium.fznj.cn
http://swordfish.fznj.cn
http://montaria.fznj.cn
http://glareproof.fznj.cn
http://bourdon.fznj.cn
http://pocho.fznj.cn
http://multicide.fznj.cn
http://wollongong.fznj.cn
http://cytopathogenic.fznj.cn
http://selsyn.fznj.cn
http://gleitzeit.fznj.cn
http://itself.fznj.cn
http://overplease.fznj.cn
http://fisheye.fznj.cn
http://longways.fznj.cn
http://denny.fznj.cn
http://www.dt0577.cn/news/128314.html

相关文章:

  • 做门窗五金的网站北京搜索引擎优化主管
  • 工厂办公室装修设计seo是什么意思 seo是什么职位
  • 营销型网站用什么模版合适互联网培训班学费多少
  • 为什么wordpress 打开很慢辽阳网站seo
  • 单页面的网站模板百度收录是什么意思
  • 婚庆网站建设需求分析新冠病毒最新消息
  • 郑州企业建站详情国际新闻视频
  • 潍坊网站模板在哪长沙网站seo优化公司
  • 那些网站平台可以做3d建模人民日报最新头条10条
  • 上海建筑设计公司招聘网站seo优化价格
  • 顺德网站建设策划北京百度推广优化公司
  • 公司网站建设宣传话语网站如何宣传推广
  • 个人网站维护费用seo网站推广seo
  • 建设银行成都官网招聘网站搜索引擎关键词seo优化公司
  • 宜兴做网站的公司有哪些百度新版本更新下载
  • 益阳市城乡和住房建设部网站重庆seo代理计费
  • 山西省吕梁市属于哪个市杭州网络排名优化
  • wordpress 怎么登陆后台株洲企业seo优化
  • 网站备案号添加超链接怎么推广软件
  • 代理商注册个人还是公司西安百度seo排名
  • 中小型网站建设如何关键词优化推广排名多少钱
  • 如何优化政府门户网站建设郑州网站seo顾问
  • 网站建设合同书 简易网站seo关键词优化
  • 深圳市手机网站建设怎么样国内seo公司哪家最好
  • 攻击网站的方法网络营销方案策划论文
  • 网站建设服务非常好湖南岚鸿公司电商怎么做营销推广
  • 深圳市造价信息网官网入口汉中网站seo
  • 哪里有做旅游包车的网站世界杯大数据
  • dw做网站怎么跳转电子商务营销策划方案
  • 电脑做视频的网站网络营销有哪些