尊龙凯时人生就是博

laravel .envÎļþÔÚÄÄ

laravelÊÇÒ»¿îÊ¢ÐеÄphp¿ò¼Ü£¬±»ÆÕ±éÓ¦ÓÃÓÚweb¿ª·¢ÖС£ÔÚlaravel¿ò¼ÜÖУ¬.envÎļþÊÇÒ»¸öºÜÊÇÖ÷ÒªµÄÎļþ£¬Ëü°üÀ¨ÁËÓëÓ¦ÓóÌÐòÏà¹ØµÄÒªº¦ÐÅÏ¢£¬ÈçÊý¾Ý¿âÉèÖá¢ÇéÐαäÁ¿µÈ¡£ÄÇô£¬ÔÚlaravelÖУ¬.envÎļþÔÚÄÇÀïÄØ £¿

LaravelÖÐ.envÎļþµÄλÖÃ

ÔÚLaravelÏîÄ¿ÖУ¬.envÎļþͨ³£Î»ÓÚÏîÄ¿¸ùĿ¼ÖС£Õâ¸öλÖÃÊÇ¿ò¼ÜĬÈϵÄλÖã¬Ò²ÊÇ×î³£ÓõÄλÖᣵ±ÎÒÃÇ·­¿ªÒ»¸öеÄLaravelÏîĿʱ£¬¿ÉÒÔ¿´µ½Ò»¸öÃûΪ.env.exampleµÄÎļþ£¬Ëü°üÀ¨ÁËËùÓеÄÇéÐαäÁ¿ºÍĬÈϵÄÉèÖá£ÎÒÃÇÐèÒª½«¸ÃÎļþ¸´ÖÆÒ»·Ý²¢ÃüÃûΪ.env²Å»ª×îÏÈʹÓá£

µ±¿ò¼ÜÆô¶¯Ê±£¬Laravel»á×Ô¶¯¼ÓÔØ.envÎļþ£¬²¢½«ÆäÖеıäÁ¿ÔØÈëµ½Ó¦ÓóÌÐòµÄÈ«¾ÖÇéÐαäÁ¿ÖС£ÔÚÓ¦ÓóÌÐòµÄÈκÎλÖö¼¿ÉÒÔͨ¹ýŲÓÃenv()º¯ÊýÀ´»ñÈ¡.envÎļþÖеıäÁ¿Öµ¡£

³ýÁËĬÈϵÄλÖã¬.envÎļþ¿ÉÒÔ·ÅÔÚÆäËûλÖá£LaravelÌṩÁ˼¸ÖÖ·½·¨À´Ö¸¶¨.envÎļþµÄλÖãº

ÐÞ¸Äbootstrap/app.phpÎļþµÄ$app->useEnvironmentPath()ÒªÁ죺

/*
|--------------------------------------------------------------------------
| Load Environment Variables
|--------------------------------------------------------------------------
|
| Here we will load the environment variables for the application which
| are stored in the .env file. You should not change this value here
| instead create a .env file in the root directory of your project.
|
*/

// $app->useEnvironmentPath(__DIR__.'/../');

$app->useEnvironmentPath(__DIR__.'/../custom/path');

µÇ¼ºó¸´ÖÆ

Ìí¼ÓÇéÐαäÁ¿LARAVEL_ENV¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÉèÖÃLARAVEL_ENVÇéÐαäÁ¿À´¸æËßLaravel¿ò¼Ü.envÎļþµÄλÖá£ÀýÈ磺

export LARAVEL_ENV=/path/to/env/file/

µÇ¼ºó¸´ÖÆ

Õâ¸öÒªÁìµÄÀûÒæÔÚÓÚÎÒÃÇ¿ÉÒÔÔÚÈκεط½ÉèÖÃLARAVEL_ENVÇéÐαäÁ¿£¬¶øÎÞÐèÐÞ¸ÄÈκοò¼ÜÎļþ¡£

ʹÓÃPHPÄÚÖú¯Êýputenv()Ö¸¶¨.envÎļþµÄλÖÃ

ÔÚLaravelÆô¶¯Ó¦ÓóÌÐò֮ǰ£¬ÎÒÃÇ¿ÉÒÔʹÓÃPHPÄÚÖú¯Êýputenv()À´ÉèÖÃÇéÐαäÁ¿¡£ÀýÈ磬ÎÒÃÇ¿ÉÒÔÔÚLaravelµÄÆô¶¯¾ç±¾ÖÐʹÓÃÒÔÏ´úÂ룺

putenv('ENV_PATH=/path/to/env/file/');

µÇ¼ºó¸´ÖÆ

ÕâÑù£¬Laravel¾Í»áÔÚÖ¸¶¨µÄλÖòéÕÒ.envÎļþ¡£

×ܽá

ÔÚLaravelÖУ¬.envÎļþÊÇÓ¦ÓóÌÐòÖеÄÖ÷ÒªÉèÖÃÎļþ£¬°üÀ¨ÁËÊý¾Ý¿âÅþÁ¬ÐÅÏ¢¡¢APIÃÜÔ¿ÒÔ¼°ÆäËûÃô¸ÐÐÅÏ¢¡£Ä¬ÈÏÇéÐÎÏ£¬.envÎļþλÓÚÏîÄ¿¸ùĿ¼ÖС£ÈôÊÇÐèÒª½«.envÎļþ°²Åŵ½ÆäËûλÖ㬿ÉÒÔͨ¹ýÐÞ¸Äbootstrap/app.php¡¢ÉèÖÃLARAVEL_ENVÇéÐαäÁ¿»òʹÓÃputenv()º¯ÊýÀ´ÊµÏÖ¡£ÎÞÂÛÄÄÖÖÒªÁ죬×îÖÕÄ¿µÄ¶¼ÊÇÈÃLaravelÄܹ»ÕÒµ½.envÎļþ£¬²¢Ê¹ÓÃÆäÖеıäÁ¿À´ÉèÖÃÓ¦ÓóÌÐò¡£

ÒÔÉϾÍÊÇlaravel .envÎļþÔÚÄĵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ