laravel¿ò¼ÜÔõôÉèÖÃÍøÕ¾Ãû
laravel¿ò¼ÜÊÇÒ»ÖÖÊ¢ÐеÄphp¿ò¼Ü£¬ËüÌṩÁËÐí¶àÓÐÓõĹ¦Ð§ºÍ¹¤¾ß£¬Ê¹µÃ¿ª·¢webÓ¦ÓóÌÐòÔ½·¢¸ßЧºÍÈÝÒס£ÔÚʹÓÃlaravel¿ª·¢webÓ¦ÓóÌÐòʱ£¬¾³£Éæ¼°µ½ÉèÖÃÍøÕ¾ÃûµÄÎÊÌâ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÉèÖÃlaravel¿ò¼ÜµÄÍøÕ¾Ãû£¬²¢ÇÒ˵Ã÷ÕâÒ»Àú³ÌµÄÖ÷ÒªÐÔ¡£
Ò»¡¢ÎªÊ²Ã´ÒªÉèÖÃÍøÕ¾Ãû
ÉèÖÃÍøÕ¾ÃûÊÇΪÁËÈ·±£ÔÚ»á¼ûÕ¾µãʱ£¬ÍøÕ¾Ãû³ÆÄܹ»ÇåÎúµØ·ºÆð¡£Õâ¹ØÓÚÆ·ÅÆ×ÅÃû¶È¡¢ËÑË÷ÒýÇæÅÅÃûºÍÓû§ÌåÑ鶼ºÜÊÇÖ÷Òª¡£ÈôÊÇÄúµÄÍøÕ¾Ãû×Ö²»Ã÷È·»òÕß²»¹æ·¶£¬ÄÇô»á¸ø»á¼ûÕß´øÀ´»ìÏýºÍδ±ã£¬½ø¶øµ¼ÖÂÓû§Á÷ʧ¡£
±ðµÄ£¬ÍøÕ¾Ãû×Ö»¹¿ÉÒÔÔÚËÑË÷ÒýÇæÖÐÆðµ½Ö÷ÒªµÄ×÷Ó᣺õÄÍøÕ¾Ãû¿ÉÒÔʹÄúµÄÍøÕ¾ÔÚËÑË÷ÒýÇæÅÅÃûÖлñµÃ¸üºÃµÄÕ¹ÏÖ£¬²¢ÇÒ¿ÉÒÔÔöÌíÓû§»á¼ûÄúÍøÕ¾µÄʱ»ú¡£
¶þ¡¢Laravel¿ò¼ÜÖеÄÉèÖÃÍøÕ¾Ãû
Laravel¿ò¼ÜÖÐÉèÖÃÍøÕ¾ÃûºÜÊǼòÆÓ£¬Ö»ÐèÒªÔÚ.envÎļþÖÐÌí¼ÓAPP_NAME¼üÖµ¶Ô¼´¿É¡£Ä¬ÈÏÇéÐÎÏ£¬¸Ã¼üµÄֵΪLaravel¡£Äú¿ÉÒÔƾ֤ÄúµÄÐèÇó¸ü¸Ä¸Ã¼üµÄÖµÀ´¸Ä±äÄúÍøÕ¾µÄÃû×Ö¡£
ÈôÊÇÒª¸ü¸ÄÍøÕ¾Ãû³Æ£¬Çëƾ֤ÒÔÏ°취¾ÙÐвÙ×÷£º
·¿ª.envÎļþ²¢²éÕÒAPP_NAME¡£Ä¬ÈÏÇéÐÎÏ£¬¼üÖµ¶ÔµÄֵΪLaravel¡£
¸ü¸ÄAPP_NAMEֵΪÄúÏ£ÍûµÄÃû³Æ£¬ÀýÈçMyWebsite¡£
ÉúÑÄ.envÎļþ¡£
Íê³ÉÒÔÉÏ°ì·¨Ö®ºó£¬ÄúµÄÍøÕ¾Ãû³Æ¾ÍÒѾ±»Àֳɸü¸Ä¡£
Èý¡¢Éó²éÍøÕ¾Ãû
ÔÚLaravel¿ò¼ÜÖУ¬¿ÉÒÔͨ¹ýÒÔÏÂÁ½ÖÖ·½·¨Éó²éÄúÍøÕ¾µÄÃû³Æ£º
ͨ¹ý¿ØÖÆÆ÷
Äú¿ÉÒÔͨ¹ý¿ØÖÆÆ÷À´Éó²éÄúµÄÍøÕ¾Ãû³Æ¡£·¿ªÄúµÄ¿ØÖÆÆ÷Îļþ£¬ÊäÈëÒÔÏ´úÂ룺
public function index() { $name = config('app.name'); return view('welcome', ['name' => $name]); }
µÇ¼ºó¸´ÖÆ
ÔÚÊÓͼÖУ¬Äú¿ÉÒÔʹÓÃÒÔÏ´úÂëÀ´Êä³öÄúµÄÍøÕ¾Ãû³Æ£º
<h1>Welcome to {{ $name }}</h1>
µÇ¼ºó¸´ÖÆ
ÕâÑùÄú¾Í¿ÉÒÔÔÚÊÓͼÖÐÊä³öÄúµÄÍøÕ¾Ãû³ÆÁË¡£
ͨ¹ýÏÂÁîÐÐ
ÈôÊÇÄúÏëÔÚÏÂÁîÐÐÖÐÉó²éÄúµÄÍøÕ¾Ãû³Æ£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
php artisan env
µÇ¼ºó¸´ÖÆ
´ËÏÂÁÊä³öÍêÕûµÄ.envÎļþÄÚÈÝ£¬²¢°üÀ¨ÄúµÄÍøÕ¾Ãû³Æ¡£
ËÄ¡¢×ܽá
ÉèÖÃÍøÕ¾Ãû³Æ¹ØÓÚÒ»¸öÍøÕ¾À´ËµºÜÊÇÖ÷Òª£¬ËüÄܹ»Ìá¸ßÆ·ÅƵÄ×ÅÃû¶ÈºÍËÑË÷ÒýÇæµÄÅÅÃû¡£Í¨¹ý±¾ÎÄËùÏÈÈݵÄÒªÁ죬ÔÚLaravel¿ò¼ÜÖÐÉèÖÃÄúµÄÍøÕ¾Ãû³Æ½«±äµÃºÜÊǼòÆÓ¡£¼Ç×Å£¬×¼È·¹æ·¶µÄÍøÕ¾Ãû³Æ¿ÉÒÔÔöÌíÓû§µÄ»á¼ûʱ»ú£¬²¢Ìá¸ßÓû§µÄÌåÑé¡£
ÒÔÉϾÍÊÇlaravel¿ò¼ÜÔõôÉèÖÃÍøÕ¾ÃûµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡