尊龙凯时人生就是博

laravelºǫ́ÔÚÄÄ¿ØÖÆ

Ëæ×Å»¥ÁªÍøÊÖÒÕµÄÒ»Ö±Éú³¤ £¬Ô½À´Ô½¶àµÄÍøÕ¾ºÍÓ¦ÓóÌÐò½ÓÄÉÁËlaravel×÷Ϊºǫ́¿ª·¢¿ò¼Ü¡£laravel¿ò¼ÜÌṩÁËÐí¶àÇ¿Ê¢µÄ¹¦Ð§ºÍ¹¤¾ß £¬Ê¹µÃ¿ª·¢ÕßÄܹ»ÇáËɵع¹½¨¸ßÖÊÁ¿µÄÓ¦ÓóÌÐò £¬²¢ÌṩӦÓû§Ò»Á÷µÄÌåÑé¡£¿ÉÊÇ £¬ÔÚʹÓÃlaravel¹¹½¨ºǫ́ʱ £¬Ðí¶à¿ª·¢Õß¿ÉÄÜ»áÓöµ½Ò»Ð©ÎÊÌâ £¬ÀýÈçÔõÑùÔÚlaravelÖпØÖƺǫ́¡£±¾ÎĽ«ÏêϸÆÊÎölaravelºǫ́µÄ¿ØÖÆ·½·¨¡£

Ò»¡¢LaravelÖкǫ́µÄ»ù±¾×é³É²¿·Ö

ÔÚ×îÏÈÏêϸ½â˵LaravelÖкǫ́µÄ¿ØÖÆ·½·¨Ö®Ç° £¬ÏÈÀ´ÏàʶһÏÂLaravelÖкǫ́µÄ»ù±¾×é³É²¿·Ö¡£LaravelÖеĺǫ́ͨ³£ÓÉÒÔϼ¸¸ö×é³É²¿·Ö×é³É£º

1.¿ØÖÆÆ÷(Controller)£ºÈÏÕæÎüÊÕÇëÇó²¢¾ÙÐд¦Àí £¬ÒÔ·µ»ØÏìÓ¦Êý¾Ý¡£

2.Ä£×Ó(Model)£ºÈÏÕæÊý¾Ý¿âµÄ²Ù×÷ £¬·â×°ÁËÓëÊý¾Ý¿âÏà¹ØµÄÂß¼­ÊµÏÖ¡£

3.·ÓÉ(Route)£ºÖ¸¶¨URLÇëÇó½øÀ´ºó¶ÔÓ¦µÄ¿ØÖÆÆ÷ºÍÒªÁì¡£

4.ÊÓͼ(View)£ºäÖȾ¿ØÖÆÆ÷·µ»ØµÄÊý¾Ý¡£

¶þ¡¢Â·ÓÉ(Route)ÔÚLaravelÖпØÖƺǫ́µÄÒªÁì

ÔÚLaravelÖÐ £¬Â·ÓÉ(Route)ÊÇ¿ØÖƺǫ́µÄ½¹µã²¿·ÖÖ®Ò»¡£¿ª·¢Õß¿ÉÒÔʹÓÃLaravelÌṩµÄ·ÓÉÆ÷(Route)À´½ç˵ºǫ́·ÓÉ £¬²¢Ö¸¶¨ÇëÇó½øÀ´ºó¶ÔÓ¦µÄ¿ØÖÆÆ÷ºÍÒªÁì¡£ÔÚLaravelÖÐ £¬½ç˵·ÓÉÓÐÁ½ÖÖ·½·¨£ºÒ»ÖÖÊÇ»ùÓÚ¿ØÖÆÆ÷µÄ·ÓÉ £¬ÁíÒ»ÖÖÊÇ»ùÓÚ±Õ°üµÄ·ÓÉ¡£

1.»ùÓÚ¿ØÖÆÆ÷µÄ·ÓÉ

»ùÓÚ¿ØÖÆÆ÷µÄ·ÓÉÊÇÖ¸ÒÔ¿ØÖÆÆ÷À´×éÖ¯´úÂë £¬¿ØÖÆÆ÷ÊÇÓ¦ÓóÌÐòµÄ½¹µã²¿·ÖÖ®Ò» £¬ËüÎüÊÕÇëÇó²¢·µ»ØÏìÓ¦Êý¾Ý¡£ÔÚLaravelÖÐ £¬¿ØÖÆÆ÷¿ÉÒÔͨ¹ýRoute::get £¬Route::post µÈÒªÁìÀ´½ç˵·ÓÉ¡£

//½¨Éèºǫ́·ÓÉ

Route::get(‘/admin/index’,[‘as’=>’admin.index’,’uses’=>’AdminIndexController@index’]);

Õâ¶Î´úÂë½ç˵ÁË/admin/indexÇëÇó½øÀ´ºó £¬Í¨¹ýAdminIndexController¿ØÖÆÆ÷ÖеÄindexÒªÁìÀ´´¦ÀíÇëÇó¡£ÆäÖÐ £¬”as”²ÎÊýÖ¸¶¨ÁË·ÓɵÄÓÖÃû £¬”uses”²ÎÊýÖ¸¶¨ÁË·ÓÉÖ¸¶¨µÄ¿ØÖÆÆ÷ºÍÒªÁì¡£

2.»ùÓÚ±Õ°üµÄ·ÓÉ

»ùÓÚ±Õ°üµÄ·ÓÉÊÇÖ¸ÓÃÄäÃûº¯ÊýÖ±½Ó´¦Àí·ÓÉÇëÇó¡£ÔÚLaravelÖÐ £¬Í¨¹ýʾÀý´úÂë¿ÉÒÔ¿´³öºÍ»ùÓÚ¿ØÖÆÆ÷µÄ·ÓɵÄΨһ²î±ð¾ÍÊÇûÓÐÁË”uses”²ÎÊý £¬¶øÊÇʹÓÃÁËÄäÃûº¯ÊýÖ±½Ó´¦Àí·ÓÉÇëÇó£º

//½¨Éèºǫ́·ÓÉ

Route::get(‘/admin/index’, function () {

return view('admin.index');

µÇ¼ºó¸´ÖÆ

});

´Ë¶Î´úÂë½ç˵ÁË/admin/indexÇëÇó½øÀ´ºó £¬Í¨¹ýÄäÃûº¯ÊýµÄÐÎʽֱ½Ó´¦ÀíÇëÇó¡£ÕâÖÖ·½·¨Ïà±ÈÓë»ùÓÚ¿ØÖÆÆ÷µÄ·ÓɽÏÁ¿¼òÆÓ £¬¿ÉÊÇûÓпØÖÆÆ÷µÄ½âñîÐÔ¸ü²î £¬ÒÔÊÇʹÓÃʱÐèҪȨºâÀû±×¡£

Èý¡¢LaravelÖпØÖÆÆ÷(Controller)¿ØÖƺǫ́µÄ·½·¨

³ýÁË·ÓÉ(Route)Íâ £¬LaravelÖеÄÁíÒ»¸ö½¹µã×é¼þ¾ÍÊÇ¿ØÖÆÆ÷(Controller)¡£¿ØÖÆÆ÷ÈÏÕæ´¦Àí·ÓÉÇëÇó £¬²¢·µ»ØÏìÓ¦Êý¾Ý¡£ÔÚLaravelÖÐ £¬º¬ÓпØÖÆÆ÷µÄ·ÓÉͨ³£ÊǽÓÄÉ»ùÓÚ¿ØÖÆÆ÷µÄ·ÓÉ·½·¨À´ÊµÏֵġ£

¿ØÖÆÆ÷ʹÓõÄÒ»Ñùƽ³£°ì·¨£º

½¨Éè¿ØÖÆÆ÷

¿ØÖÆÆ÷µÄ½¨ÉèÐèҪͨ¹ýphp artisanÏÂÁîÐй¤¾ß £¬ÔÚÖÕ¶ËÊäÈëÒÔÏ´úÂëÀ´½¨Éè¿ØÖÆÆ÷£º

php artisan make:controller ControllerName

ÕâÀïµÄControllerNameÖ¸µÄÊÇ¿ØÖÆÆ÷µÄÃû³Æ¡£ÀýÈç £¬½¨ÉèÃûΪAdminControllerµÄ¿ØÖÆÆ÷Ó¦¸ÃÊäÈëÒÔÏ´úÂ룺

php artisan make:controller AdminController

¿ØÖÆÆ÷±»½¨ÉèÖ®ºó £¬ÔÚapp/Http/ControllersĿ¼Ï¾ÍÄÜÕÒµ½ËüÁË¡£

½ç˵·ÓÉ

»ùÓÚ¿ØÖÆÆ÷µÄ·ÓÉÊǽÓÄÉRoute::get,Route::postµÈÒªÁìÀ´½ç˵µÄ £¬Õâ¸öºÍÉÏÃæ½²µ½µÄ·½·¨²îδ¼¸¡£

Route::get(‘/admin/index’, [‘as’ => ‘admin.index’, ‘uses’ =>’AdminController@index’]);

3.ʵÏÖ¿ØÖÆÆ÷ÒªÁì

¿ØÖÆÆ÷ʵÏÖµÄÒªÁìÐèҪȷ±£Äܹ»Öª×ã·Óɽç˵µÄÇëÇó¡£ÏÂÃæÊÇÒ»¸ö×î¼òÆӵĿØÖÆÆ÷ÒªÁ죺

public function index()
{
    return view('admin.index');
}

µÇ¼ºó¸´ÖÆ

Õâ¸öº¯ÊýÎüÊÕ/admin/index·ÓÉ·¢³öµÄÇëÇó £¬·µ»Øadmin.indexÊÓͼÎļþ¡£

ËÄ¡¢½áÂÛ

×ܶøÑÔÖ® £¬ÔÚLaravelÖпØÖƺǫ́ÓÐÁ½ÖÖÖ÷Òª·½·¨£ºÒ»ÖÖÊÇ»ùÓÚ·ÓɵĿØÖÆ·½·¨ £¬ÁíÒ»ÖÖÊÇ»ùÓÚ¿ØÖÆÆ÷µÄ¿ØÖÆ·½·¨¡£ÎÒÃÇ¿ÉÒÔƾ֤ÏîÄ¿µÄ¾Þϸ¡¢ÖØƯºóºÍСÎÒ˽ÈËϲ»¶À´Ñ¡Ôñ²î±ðµÄ¿ØÖÆ·½·¨¡£

×ÜÖ® £¬ÎÞÂÛ½ÓÄÉÄÄÒ»ÖÖ·½·¨À´¿ØÖÆLaravelºǫ́ £¬¶¼ÐèÒªÊìÁ·ÕÆÎÕÏà¹ØµÄÊÖÒÕºÍ֪ʶ £¬Ê¼ÖÕ¼á³Ö¶Ô´úÂëÖÊÁ¿µÄ¸ß¶È°Ñ¿ØºÍ¶ÔÓû§µÄ¹Ø×¢¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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