您的位置 首页 php

laravel框架的环境检测与配置加载

环境检测阶段是对程序运行的环境进行总体配置,这部分内容实际上和配置加载的功能是相同的,都是配置应用程序的运行环境,包括系统配置、身份认证配置、 缓存 配置、数据库配置、文件系统配置和sessions配置等。这些配置都是以文件形式提供的,其中环境检测文件是 Laravel 框架根目录下的.evn文件,而配置加载的配置文件是laravel config 目录下的所有文件,两者的关系可以看做是主从的关系,即在配置加载过程中设置的参数都可以在.evn文件中进行设置,而.evn中对环境的配置将会覆盖配置加载项,当然也可以修改成不覆盖。说简单点,就是将一些重要的配置参数从laravelconfig目录下的文件中提取到.evn文件中,这样易于随时修改。首先给出环境检测加载的源码:文件Illuminate Foundation BootstrapDetectEnvironment.php

laravel框架的环境检测与配置加载

文件laravelvendorvlucasphpdotenvsrcDotenv.php

laravel框架的环境检测与配置加载

DetectEnvironment类的bootstrap()函数通过Dotenv::load()静态函数实现.env文件的配置加载,在.env文件中配置项以“配置项=参数值”的形式给出,最后通过静态函数setEnvironmentVariable()给配置项“putenv(”$name=$value”);”设置 环境变量 ,并在$_ENV和$_SERVER全局数组中记录。对于配置加载,是通过LoadConfiguration类的bootstrap()函数实现的。部分源代码如下:文件IlluminateFoundationBootstrapLoad Config uration.php

laravel框架的环境检测与配置加载

首先会查找是否有缓存的配置文件,如果有将先加载,这样加载配置项速度快,否则将文件顺序加载。对于程序配置项,将会存放到一个仓库类(Repository类)实例中,而该类的实例被添加进服务容器的共享实例数组中,服务名称为“config”,以后就可以用该名称通过服务容器自动获得需要的配置参数。在完成仓库类的 实例化 和服务绑定后,将通过loadConfigurationFiles()函数进行配置项的加载。接下来介绍加载的实现过程。文件IlluminateFoundationBootstrapLoadConfiguration.php

laravel框架的环境检测与配置加载

文件IlluminateConfigRepository.php

laravel框架的环境检测与配置加载

对于配置项的加载,首先需要获取配置文件,通过getConfigurationFiles()将Laravel框架下的配置文件全部读取出来并存储到$files数组中返回,该过程是通过服务容器获取配置文件的路径(代码“$app->configPath()”),然后通过 Symfony 组件中的探测类(SymfonyComponentFinderFinder类)实现文件的识别,最后提取出文件名和文件路径并以关联数组的形式(如“app”=>“D:WWWlaravelconfigapp.php”)存储到$files数组中返回。对于配置文件,每个文件返回一个数组,这里通过“require’文件路径’”的形式获取配置项数组,最后通过仓库实例的set()函数添加到仓库中。

文章来源:智云一二三科技

文章标题:laravel框架的环境检测与配置加载

文章地址:https://www.zhihuclub.com/77358.shtml

关于作者: 智云科技

热门文章

评论已关闭

47条评论

  1. Cialis may not be safe for people who take medications for high blood pressure, an enlarged prostate, or for those who consume substantial amounts of alcohol

  2. Likewise, some groups of people are not considered good candidates for sildenafil Xuzhou, Dangshan and other areas are in Dahan is under the rule of buy cialis online united states buy cialis online united states pills to help women want more sex Henan Dao

  3. cialis prednisolone zentiva 20 mg effets secondaires Across all specialties, physicians see roughly 13 patients per day, work 52 hours per week and earn an average of 270, 000

  4. levitra tylenol infantil xarope bula We still expect this year to be a struggle in the euro zoneand also next year, said Societe Generale economist AnatoliAnnenkov

  5. These two trials were strikingly different from the NSABP P 1 trial, however, and they included a different population of women

  6. Nasioudis D, Doulaveris G, Kanninen TT Heterogeneity of the DCIS was seen as a potential cause for a lower than expected Oncotype DCIS score in these cases

  7. com 20 E2 AD 90 20Harga 20Viagra 20Di 20Apotik 20Umum 20 20Viagra 20Feminino 20Natural 20Valor viagra feminino natural valor The shares fell 2

  8. The woman usually places the dilators herself Ozanne and Esserman and colleagues at UCSF, generates tailored patient specific risk assessments using established risk models including Gail, BRCApro, Claus, BCSC density based on patient data 29 32

  9. Interestingly, differential LPA signaling through LPAR1 and LPAR3 transduces opposing signals to determine the fate of MSCs In total, 48 cancers were identified in MHT exposed women and 174 cancers were identified in unexposed women

  10. 3a, H 4 was the proton on the guest while H c, H d, H e were the protons on MSP5, the crosspeak A indicates that H 4 is in close contact with H d, H e, and the crosspeak B indicates that H 4 also interacts H c, suggesting that alkyl of G1 penetrated into the cavity of MSP5 to form a good inclusion complex ER tumors were given higher priority scores than ER tumors, where endocrine therapy might safely allow further delay of surgery

  11. You re PCT is likely going to fail Transient simulation of the striatum was performed during routine Deep Brain Stimulation DBS implantation on various subjects

  12. It is much bigger than what they pay A variety of neurotrophins markedly increase the number of nNOS neurons, nNOS protein, and NOS catalytic activity and enhance NMDA neurotoxicity through NO dependent mechanisms when neurons are grown on glial feeder layers

  13. However, downregulation of RIP1 with siRNA did not have an apparent effect on TRAIL mediated STAT1 phosphorylation Fig 7B and 7C or induction of IFN responsive genes Fig 7D

  14. As expected for ISH positive disease, ASCO CAP group 1 breast cancer patients from the BCIRG 006 trial had a significantly improved DFS and OS, among those randomized to trastuzumab compared with those who received standard AC T chemotherapy alone

  15. Clomiphene citrate CC promotes follicular development through blocking the negative feedback of estrogen to the hypothalamus and making the pituitary secrete gonadotropin

  16. Effect of autoimmune thyroid disease in older euthyroid infertile woman during the first 35 days of an IVF cycle

  17. My RE found that OPK were not reliable enough for me so I do bloodwork to see when I will surge Gentle exercise bikes

  18. In general, evidence changes rapidly in controversial, high stakes areas in medical care, which are the same areas that often are appropriate for decision support

  19. But in the current situation, there seems to be nothing to say Fight back Hongsha directly pulled out the crimson sword in his hand, and once again brought the sword drawing flow to the fullest This kind of move can already be used by Hong Sha with his eyes closed

  20. These investigators found slowly developing and very sparse contextual representations that were stable for up to 2 months

  21. The incident atHeathrow happened while the plane was on the ground and had beenfor more than eight hours and was not related to flight safety SULT1A1 mRNA levels were highly correlated across cell lines with NFI B r 0

  22. Patients with compensated Child A cirrhosis have sub clinical hypovolemia and diuretic treatment could result in renal impairment Sinus infection treatment pricing details

  23. Cooper first became interested in health and fitness while in medical school where she began training in powerlifting and learning about how diet influences athletic performance

网站地图