laravelΪʲôÕÒ²»µ½.evnÎļþ
ÔÚʹÓÃlaravel¾ÙÐпª·¢Ê±£¬ÎÒÃdz£³£»áʹÓÃ.envÎļþÀ´ÉúÑÄ×ðÁú¿Ê±ÇéÐÎÉèÖÃÐÅÏ¢¡£Õâ¸öÎļþ½ÏÁ¿Ö÷Òª£¬Òò´ËÔÚʹÓÃlaravelµÄÀú³ÌÖлáÓÐһЩÎÊÌâºÍ¹ýʧ£¬ÆäÖÐÖ®Ò»¾ÍÊÇÕÒ²»µ½.envÎļþµÄÇéÐΡ£Õâ¸öÎÊÌâÓÐÐí¶àÔµ¹ÊÔÓÉ£¬ÏÂÃæ¾ÍÀ´ÖðÒ»ÆÊÎö¡£
Ò»¡¢ÎļþδÌí¼Óµ½°æ±¾¿â
ÈôÊÇÄãÕýÔÚʹÓð汾¿ØÖÆϵͳ£¬ÀýÈçGit£¬ÄÇôÔÚÄãµÄÏîÄ¿ÖУ¬.envÕâ¸öÎļþÊDz»»á±»Ìá½»µ½°æ±¾¿âµÄ¡£Í¨³£À´Ëµ£¬ÄãµÄ.gitignoreÎļþÓ¦¸Ã°üÀ¨.envÎļþ£¬ÕâÑùÒ»À´.git»áºöÂÔÕâ¸öÎļþ£¬Ëü¾Í²»»á±»Ìá½»µ½°æ±¾¿âÖÐÁË¡£
¶þ¡¢ÎļþÃû¹ýʧ
ÔÚLaravelÖУ¬ÎÒÃÇʹÓõÄÊÇ.envÎļþ£¬ÈôÊÇÄãƾ֤ÃüÃûÏ°¹ß£¬½«ÎļþÃû¸ÄΪÁËÓ¢Îĵġ°env¡±£¬»òÕßÆäËû²»×¼È·µÄÃû×Ö£¬ÄÇô¾Í»á±»ÊÓΪûÓÐÕÒµ½Îļþ¡£
Èý¡¢ÎļþλÖùýʧ
ͨ³£À´Ëµ£¬.envÎļþÓ¦¸Ã·ÅÔÚ¸ùĿ¼ÖУ¬Ò²¾ÍÊǺÍcomposer.jsonµÈÎļþͬ¼¶¡£ÈôÊÇÄ㽫.envÎļþ·ÅÔÚÆäËûλÖ㨺ñÈpublicµÈĿ¼£©£¬ÄÇôLaravelÒ²»áÌáÐÑ¡°ÕÒ²»µ½.envÎļþ¡±¡£
ËÄ¡¢½â¾öÒªÁì
ÈôÊÇÄãÓöµ½ÁËÕÒ²»µ½.envÎļþµÄÇéÐΣ¬ÄÇô¿ÉÒÔʹÓÃÒÔÏÂÒªÁìÀ´½â¾ö£º
1.¼ì²é.gitignoreÎļþÊÇ·ñ°üÀ¨ÁË.envÎļþ£¬ÈôÊÇÊÇ£¬ÔòÔÚÌύǰ½«.envÎļþÌí¼Óµ½°æ±¾¿âÖС£
2.¼ì²é.envÎļþÃûÊÇ·ñ׼ȷ£¬Ó¦¸ÃÊÇ¡°.env¡±£¬¶ø²»ÊÇÆäËûÃû×Ö¡£
3.¼ì²é.envÎļþÊÇ·ñ·ÅÔÚÁË׼ȷµÄλÖ㬼´ÏîÄ¿¸ùĿ¼¡£
4.ÈôÊÇÒÔÉÏÒªÁ춼²»Æð×÷Ó㬿ÉÒÔʵÑéÖ±½Ó´ÓGitHubÏÂÔØLaravelÔ´Â룬²¢½«.env.exampleÎļþ¿½±´Îª.envÎļþ£¬È»ºóÖØÐÂ×°Öà composer ÒÀÀµ¡£
LaravelÊÇÒ»¸ö¸ßЧµÄPHP¿ò¼Ü£¬.envÎļþÊǺÜÊÇÖ÷ÒªµÄÒ»¸öÎļþ£¬ËüÉúÑÄ×ÅËùÓеÄÇéÐαäÁ¿£¬Òò´ËÔÚʹÓÃLaravelµÄʱ¼ä£¬ºÜÊÇÐèҪעÖØÕâ¸öÎļþµÄ±£´æ¡£ÒÔÉϾÍÊÇÕÒ²»µ½.envÎļþµÄÔµ¹ÊÔÓÉÏ¢Õù¾öÒªÁ죬ϣÍû¶ÔÄãÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇlaravelΪʲôÕÒ²»µ½.evnÎļþµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡