您的位置 首页 php

关于PHP框架中.env文件的加载过程

关于PHP框架中.env文件的加载过程

现在很多框架使用根目录的.env文件来配置环境变量,php本身是不会去解析这个文件的,需要使用php代码读取和解析这个文件放入环境变量中。

例如查看thinkphp中.env文件的加载过程 , 使用下面这个strace命令查看fpm进程stat文件状态的过程。

strace $(pidof 'php-fpm'|sed 's/([0-9]*)/-p 1/g') -e stat -s 1024

返回的这条,就是在查看.env文件是否存在。

[pid 11692] stat("/data1/mailLog/public/phpdev/xxx/xxx/.env", 0x7fff6ba5f9f0) = -1 ENOENT (No such file or directory)

处理的代码是这几句

if (is_file(ROOT_PATH . '.env')) {    $env = parse_ini_file(ROOT_PATH . '.env', true);    foreach ($env as $key => $val) {        $name = ENV_PREFIX . strtoupper($key);        if (is_array($val)) {            foreach ($val as $k => $v) {                $item = $name . '_' . strtoupper($k);                putenv("$item=$v");            }        } else {            putenv("$name=$val");        }    }}

更多相关php知识,请访问php教程!

以上就是关于PHP框架中.env文件的加载过程的详细内容,更多请关注求知技术网其它相关文章!

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

文章标题:关于PHP框架中.env文件的加载过程

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

关于作者: 智云科技

热门文章

评论已关闭

30条评论

  1. Purpose The use of cytochrome P450 2D6 inhibiting drugs CYP2D6 inhibitors during tamoxifen treatment leads to a decrease in plasma concentration of endoxifen, the major active tamoxifen metabolite

  2. All he wants to do, Francis says, is bulk up just enough to fill out his 6 4 frame We only included patients prescribed with hormone therapy longer than 3 months

  3. Although late passage p53 wild type MEF cells demonstrate a diminished apoptotic response to genotoxic stress, the p53 functions of cell cycle arrest and p21 induction remain intact

  4. D, E, Quantification of coexpression for ChR2 EYFP, Nefh, and Ret represented as a percentage of the population mean SEM, n 6 animals, 2 3 sections animal

  5. We report that autophagy can be activated by gefitinib or erlotinib in lung cancer cells, which contributes to the acquired drug resistance of EGFR TKIs

  6. You will also notice a marked improvement in your strength, aggression and performance 4 Multiparticulate Controlled Release Devices

  7. I m 30 and have waited for my husband and I both to get our degrees and a stable home life Pulp neurovascular bundle exits via the apical foramen at the root apex

  8. html levofloxacin eye drop coupon Only a decade ago, the former Portuguese colony was agangster s paradise where rivals regularly settled disputes withguns

  9. Glomerular filtration is probably a route of excretion, although partial reabsorption and active tubular secretion are also involved, especially at low creatinine clearance rates

  10. Common sense might suggest that, with the referendum now just a year away, indecision will soon be starting to harden up

  11. 33 reports that gefitinib resistant NSCLC cells have elevated levels of lncRNA LINC00460 compared to non resistant cells It appears that if steric bulk around the central boron atom or rigidity is increased, for example, as in compounds 2j, 6a, 6b, and 11 compounds 9 12 in Figure 13

  12. 184 In a mouse model of male infertility, shilajit improved testicular function, increased sperm and testosterone production, reversed the toxic effect of the heavy metal cadmium on sperm motility and concentration, and induced fertility

  13. 52 while you re on Epistane Wouldn t it be better to allow the investigators the time they need to fully understand the entire situation instead of being pushed into making short sighted decisions that can neither be reversed or altered especially when relevant new information surfaces

  14. The race to ovulate can take anywhere from about eight days to a month or longer to complete, depending on how soon your body reaches an estrogen threshold

  15. pdf teenagers preco do levodopa Likewise, should we stop scanning the skies for intelligent alien signals because of budget restraints and political shortsightedness

  16. Lyman also stressed the need for both randomized controlled trials and real world data sources to enhance the understanding of the full impact of treatment on patients

  17. Soo I went to the specialist today Bc I have not had a period in 45 days Other cutaneous abnormalities that may develop in RMSF include postinflammatory hyperpigmentation, jaundice, and mucosal ulcers

  18. This suppressed ACTH secretion and reduced adrenal function, resulting in the poor response to tetracosactrin

网站地图