×ðÁú¿­Ê±

laravel¸ü¸Älocal

ÔÚlaravel¿ª·¢ÖУ¬local¿ª·¢ÇéÐÎÊÇÒ»¸ö³£¼ûµÄÑ¡Ïî¡£ËüΪÎÒÃÇÌṩÁËÒ»ÖÖ¼¯³ÉÇéÐΣ¬¿ÉÒÔÈÃÎÒÃÇÔÚ¿ª·¢Ê±´ú¿ìËٵع¹½¨¡¢µ÷ÊԺͲâÊÔÓ¦ÓóÌÐò¡£

È»¶ø£¬ÔÚijЩÇéÐÎÏ£¬¿ÉÄÜÐèÒªÐ޸Ļò¸ü¸ÄlocalÇéÐÎÒÔ˳ӦÌض¨ÏîÄ¿»òÇéÐΡ£ÔÚÕâƪÎÄÕÂÖУ¬ÎÒÃǽ«ÌÖÂÛÔõÑù¸ü¸ÄlocalÇéÐΡ£

Ã÷È·LaravelµÄÇéÐÎÉèÖÃ

LaravelÓ¦ÓóÌÐò¿ÉÒÔÔÚ¶à¸öÇéÐÎÖÐÔËÐУ¬ÀýÈ翪·¢¡¢²âÊÔ¡¢Éú²úÇéÐεÈ¡£Ã¿¸öÇéÐζ¼ÓÐÆäÆæÒìµÄÉèÖÃÐèÇ󣬺ñÈÊý¾Ý¿âÅþÁ¬¡¢»º´æÇý¶¯¡¢ÈÕÖ¾ÉèÖõÈ¡£

LaravelµÄÇéÐÎÉèÖÃÊÇͨ¹ý.envÎļþʵÏֵġ£.envÎļþ°üÀ¨ÁËÓ¦ÓóÌÐòËùÐèµÄËùÓÐÇéÐαäÁ¿ºÍÉèÖÃÏî¡£ÔÚÕâ¸öÎļþÖУ¬ÎÒÃÇ¿ÉÒÔÉèÖÃAPP_ENV±äÁ¿À´Ö¸¶¨Ó¦ÓóÌÐòÔËÐеÄÇéÐΡ£

ÎÒÃÇ¿ÉÒÔÔÚ¸ùĿ¼ÏµÄ.envÎļþÖоÙÐÐÉèÖãº

APP_ENV=local
APP_DEBUG=true

µÇ¼ºó¸´ÖÆ

ÉÏÃæµÄÉèÖÃÖ¸¶¨ÁËÄ¿½ñÓ¦ÓóÌÐòÔËÐÐÔÚlocalÇéÐΣ¬²¢ÆôÓÃÁ˵÷ÊÔģʽ¡£

ÔÚ²î±ðµÄÇéÐÎÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ý×Ô½ç˵.envÎļþÀ´ÁýÕÖ»òÀ©Õ¹Ä¿½ñµÄÇéÐÎÉèÖá£ÀýÈ磬ÎÒÃÇ¿ÉÒÔ½¨ÉèÒ»¸öÃûΪ.env.testingµÄÎļþÀ´Îª²âÊÔÇéÐÎÉèÖòî±ðµÄÊý¾Ý¿âÅþÁ¬ºÍÆäËûÉèÖÃÏî¡£

¸ü¸ÄLaravelµÄlocalÇéÐÎ

ÈôÊÇÎÒÃÇÐèÒªÐ޸Ļò¸ü¸ÄlocalÇéÐΣ¬¿ÉÒÔʹÓÃÒÔÏÂÒªÁ죺

1. ×Ô½ç˵.env.localÎļþ

LaravelÖ§³Ö.env.localÎļþ£¬¸ÃÎļþÓÃÓÚÀ©Õ¹»òÁýÕÖĬÈϵÄlocalÇéÐÎÉèÖá£ÈôÊÇLaravel¼ì²âµ½´ËÎļþ±£´æ£¬Ëü½«¶ÁÈ¡´ËÎļþÖеÄÇéÐαäÁ¿²¢ÁýÕÖĬÈϵÄ.envÖеÄÉèÖÃÏî¡£

ÀýÈ磬ÎÒÃÇ¿ÉÒÔÔÚÓ¦ÓóÌÐò¸ùĿ¼´¦½¨ÉèÒ»¸öÃûΪ.env.localµÄÎļþ£¬²¢Îª¿ª·¢ÇéÐÎÖ¸¶¨²î±ðµÄÉèÖÃÏ

APP_ENV=dev
APP_DEBUG=false

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄʾÀýÖУ¬ÎÒÃǽ«Ó¦ÓóÌÐòÇéÐθü¸ÄΪdev£¬²¢½ûÓÃÁ˵÷ÊÔģʽ¡£

2. ×Ô½çÌÖÇéÐαäÁ¿

³ýÁË.env.localÎļþÍ⣬ÎÒÃÇ»¹¿ÉÒÔʹÓÃ×Ô½ç˵µÄÇéÐαäÁ¿À´Ð޸Ļò¸ü¸ÄlocalÇéÐΡ£

ÀýÈ磬ÎÒÃÇ¿ÉÒÔʹÓÃShellÏÂÁîÉèÖÃ×Ô½ç˵µÄÇéÐαäÁ¿£º

export APP_ENV=dev
export APP_DEBUG=false

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄÀý×ÓÖУ¬ÎÒÃǽ«Ó¦ÓóÌÐòÇéÐÎÉèÖÃΪdev£¬²¢½ûÓÃÁ˵÷ÊÔģʽ¡£ÕâÑù£¬µ±ÎÒÃÇÔËÐÐLaravelÓ¦ÓóÌÐòʱ£¬Ëü½«×Ô¶¯´ÓÇéÐαäÁ¿ÖжÁÈ¡ÕâЩÉèÖÃÏî¡£

3. ÐÞ¸ÄÉèÖÃÎļþ

ÈôÊÇÐèÒª¸ü³¹µ×µØ¸ü¸ÄlocalÇéÐÎÉèÖ㬻¹¿ÉÒÔÐÞ¸Äconfig/app.phpÉèÖÃÎļþ¡£ÔÚÕâ¸öÎļþÖУ¬ÎÒÃÇ¿ÉÒÔÉèÖÃÓ¦ÓóÌÐòËùÐèµÄËùÓÐЧÀÍ¡¢ÌṩÕߺÍÀ©Õ¹¡£

ÀýÈ磬ÎÒÃÇ¿ÉÒÔÔÚconfig/app.phpÖÐÐÞ¸ÄdebugÑ¡ÏîºÍurlÑ¡Ï

return [
    'debug' => false,

    'url' => 'http://localhost:8000',
];

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄʾÀýÖУ¬ÎÒÃǽ«µ÷ÊÔģʽÉèÖÃΪ½ûÓ㬲¢½«Ó¦ÓóÌÐòµÄURLÉèÖÃΪhttp://localhost:8000¡£

ÐèҪעÖصÄÊÇ£¬ÔÚʹÓôËÒªÁìÐÞ¸ÄlocalÇéÐÎÉèÖÃʱ£¬ÎÒÃÇÐèÒª¼á³ÖÎÞаÐÔ£¬²¢ÔÚ²»Ó°ÏìÆäËûÇéÐεÄÇéÐÎϾÙÐÐÐ޸ġ£

×ܽá

ÔÚ±àдºÍµ÷ÊÔLaravelÓ¦ÓóÌÐòʱ£¬localÇéÐÎÊÇÒ»¸öºÜÊÇÀû±ãºÍÊÊÓõĿª·¢ÇéÐΡ£ÈôÊÇÎÒÃÇÐèÒªÐ޸Ļò¸ü¸ÄlocalÇéÐÎÒÔ˳ӦÌض¨µÄÏîÄ¿»òÇéÐΣ¬¿ÉÒÔʹÓÃÒÔÉÏÒªÁìʵÏÖ¡£

ÖµµÃ×¢ÖصÄÊÇ£¬ÎÞÂÛ½ÓÄÉÄÄÖÖÒªÁì¾ÙÐÐÐ޸ģ¬ÎÒÃǶ¼ÐèÒª×ñÕÕÓÅÒìµÄʵ¼ùºÍ×î¼ÑµÄÇå¾²ÐÔ¡¢¿Éά»¤ÐԺͿÉÀ©Õ¹ÐÔÔ­Ôò¡£

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

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

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

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