尊龙凯时人生就是博

laravel ÔöÌí·ÓÉÎļþ

laravelÊÇÒ»¸öÊ¢ÐеÄphp¿ò¼Ü£¬¾ßÓо«Á·ÓÅÃÀµÄÓï·¨ºÍÇ¿Ê¢µÄ¹¦Ð§¡£ÔÚʹÓÃlaravel¿ª·¢Ó¦ÓóÌÐòʱ£¬¾­³£ÐèÒªÌí¼Ó×Ô½ç˵·ÓÉÀ´´¦Àí»á¼û²î±ðÒ³ÃæµÄÇëÇó¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlaravelÏîÄ¿ÖÐÔöÌí×Ô½ç˵·ÓÉÎļþ£¬Àû±ã¿ª·¢Ö°Ô±ÖÎÀíºÍά»¤Â·ÓÉÐÅÏ¢¡£

н¨Â·ÓÉÎļþ

ÔÚLaravelÏîÄ¿µÄroutesĿ¼Ï£¬Í¨³£»áÓÐÒ»¸öweb.phpÎļþºÍapi.phpÎļþ¡£ÕâÁ½¸öÎļþ»®·ÖÓÃÓÚ½ç˵WebºÍAPI·ÓÉ¡£ÎÒÃÇ¿ÉÒÔÔÚÕâ¸öĿ¼ÏÂн¨Ò»¸öÃûΪcustom.phpµÄÎļþ£¬ÓÃÓÚ´æ·Å×Ô½ç˵·ÓÉ¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÔÚÏÂÁîÐÐÖн¨ÉèÒ»¸öÐÂÎļþ£º

touch routes/custom.php

µÇ¼ºó¸´ÖÆ

ÉèÖ÷ÓÉÎļþ

·­¿ªcustom.phpÎļþ£¬×îÏÈÉèÖÃ×Ô½ç˵·ÓÉ¡£Â·ÓÉ·ÖΪget¡¢post¡¢put¡¢deleteµÈÀàÐÍ£¬»®·Ö´¦ÀíÓû§µÄÇëÇó¡£ÏÂÃæÊÇÒ»¸ö¼òÆÓµÄÀý×Ó£¬ÓÃÓÚ´¦ÀíGETÇëÇó»á¼ûÒ»¸ö×Ô½ç˵ҳÃ棺

Route::get('/custom-page', function () {
    return view('custom');
});

µÇ¼ºó¸´ÖÆ

ÉÏÊö´úÂëÖУ¬½ç˵ÁËÒ»¸öÃûΪcustom-pageµÄ·ÓÉ£¬¸Ã·ÓɵÄÏìÓ¦º¯Êý·µ»ØÁËÒ»¸öÃûΪcustomµÄÊÓͼ£¬ÓÃÓÚչʾ×Ô½ç˵ҳÃæ¡£ÕâÀïµÄÊÓͼÎļþÐèÒªÔÚresources/viewsĿ¼ÏÂÏȽ¨ÉèºÃ¡£

×¢²á·ÓÉÎļþ

ΪÁËÈÃLaravelÏîÄ¿Äܹ»Ê¶±ðºÍʹÓÃcustom.phpÎļþÖеÄ·ÓÉ£¬ÐèÒªÔÚÏîÄ¿ÖÐ×¢²á¸ÃÎļþ¡£¿ÉÒÔÔÚapp/Providers/RouteServiceProvider.phpÎļþÖеÄmapº¯ÊýÖÐÌí¼ÓÈçÏ´úÂ룺

protected function mapCustomRoutes()
{
    Route::middleware('web')
        ->namespace($this->namespace)
        ->group(base_path('routes/custom.php'));
}

µÇ¼ºó¸´ÖÆ

ÉÏÊö´úÂëÖУ¬½ç˵ÁËÒ»¸öÃûΪmapCustomRoutesµÄº¯Êý£¬ÓÃÓÚ×¢²á×Ô½ç˵·ÓÉÎļþ¡£Ôڸú¯ÊýÖÐʹÓÃgroupº¯Êý½«×Ô½ç˵·ÓÉÎļþ°ó¶¨µ½WebÖÐÐļþÏ£¬²¢Ö¸¶¨ÁË·ÓÉÎļþËù´¦µÄĿ¼·¾¶¡£

½ÓÏÂÀ´£¬ÔÚRouteServiceProvider.phpÎļþÖеÄmapº¯ÊýÖÐŲÓÃmapCustomRoutesº¯Êý¼´¿ÉÍê³É×Ô½ç˵·ÓɵÄ×¢²á£º

public function map()
{
    $this->mapWebRoutes();

    $this->mapApiRoutes();

    $this->mapCustomRoutes(); // ×¢²á×Ô½ç˵·ÓÉÎļþ
}

µÇ¼ºó¸´ÖÆ

²âÊÔ×Ô½ç˵·ÓÉ

Íê³É×Ô½ç˵·ÓÉÎļþµÄÉèÖúÍ×¢²áºó£¬¾Í¿ÉÒÔÔÚÏîÄ¿ÖвâÊÔ×Ô½ç˵·ÓÉÁË¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÆô¶¯LaravelÏîÄ¿£¬²¢ÔÚä¯ÀÀÆ÷Öлá¼ûhttp://localhost/custom-page£¬Éó²éÊÇ·ñÀֳɼÓÔØ×Ô½ç˵ҳÃ棺

php artisan serve

µÇ¼ºó¸´ÖÆ

×Ô½ç˵ҳÃæµÄ»á¿´·¨Ö·Îª£ºhttp://localhost/custom-page

×ܽá

ÒÔÉϾÍÊÇÔÚLaravelÏîÄ¿ÖÐÔöÌí×Ô½ç˵·ÓÉÎļþµÄ°ì·¨¡£Í¨¹ý½¨Éè×Ô½ç˵·ÓÉÎļþ£¬¿ÉÒÔ¸üºÃµØÖÎÀíºÍά»¤LaravelÓ¦ÓóÌÐòÖÐÖÚ¶àµÄ·ÓÉÐÅÏ¢¡£Í¬Ê±£¬Ò²Ê¹µÃ·ÓÉÂß¼­Ô½·¢ÇåÎúºÍÒ×ÓÚ¿ª·¢Ö°Ô±Ã÷È·ºÍµ÷ÊÔ¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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