尊龙凯时人生就是搏

thinkPHP5ÖÐÔõôÒþ²ØÈë¿ÚÎļþ

Ò»¡¢ÇéÐÎ×¼±¸

ÔÚ¾ÙÐÐURLÒþ²Ø֮ǰ£¬ÎÒÃÇÐèÒªÏȼì²éÒ»ÏÂÍâµØÇéÐÎÊÇ·ñÖ§³Öα¾²Ì¬¹¦Ð§ºÍURLÖØд¹¦Ð§£¬ÕâÑù²Å»ªË³Ëì¾ÙÐÐURLÒþ²Ø²Ù×÷¡£Ê×ÏÈÎÒÃÇҪȷ±£×°ÖÃÁËApache»òÕßNginxµÈwebЧÀÍÆ÷£¬È»ºóÔÚÉèÖÃÎļþÖÐÆôÓÃα¾²Ì¬ºÍURLÖØд¹¦Ð§£¬ÕâÑù²Å»ªÊ¹µÃ¿ò¼Üʶ±ðÌìÉúÃÀ»¯ºóµÄURL¡£

¶þ¡¢¿ªÆôURLÒþ²Ø

·­¿ªÉèÖÃÎļþ

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

ÔÚthinkPHP5µÄÉèÖÃÎļþÖУ¬ÕÒµ½app.phpÎļþ£¬ÕÒµ½url_html_suffixÉèÖÃÏ½«ÆäÉèÖÃΪ¿Õ×Ö·û´®£¬¼´£º

'url_html_suffix'  =>  ''

µÇ¼ºó¸´ÖÆ

ÕâÑù¾ÍÔÊÐíURL²»´øºó׺ÁË¡£

ÉèÖ÷ÓÉ

ͨ¹ýÔÚthinkphp5ÖÐÉèÖ÷ÓɹæÔò£¬»á¼ûURL¿ÉÒÔÓ³Éäµ½ÏìÓ¦µÄ¿ØÖÆÆ÷»ò²Ù×÷ÒªÁì¡£ÎÒÃÇÐèÒªÕë¶Ôÿ¸ö¿ØÖÆÆ÷»ò²Ù×÷ÒªÁì¾ÙÐжÔÓ¦µÄ·ÓÉÉèÖ㬽«Æä¶ÔÓ¦µÄURLÓ³Éäµ½Ò»¸öÓÐÒâÒåµÄÄÚÈÝÉÏ£¬ÕâÑù²Å»ªÊ¹µÃÒþ²ØµÄЧ¹ûÊ©Õ¹³öÀ´£¬ÀýÈ磺

Route::get('news/:id','index/index/news',[],['id'=>'\d+']);

µÇ¼ºó¸´ÖÆ

ÕâÑù£¬»á¼û/news/1Õâ¸öURLʱ£¬¾Í»á×Ô¶¯Å²ÓÃindex¿ØÖÆÆ÷µÄnews²Ù×÷ÒªÁ죬²¢½«ÇëÇó²ÎÊýidÉèÖÃΪ1¡£

ÉèÖÃЧÀÍÆ÷

ÔÚApache»òÕßNginxÖÐÒ²Òª¾ÙÐÐÏìÓ¦µÄÉèÖá£ÒÔApacheΪÀý£¬ÔÚ.htaccessÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]

µÇ¼ºó¸´ÖÆ

Õâ¶Î´úÂëÖУ¬RewriteEngine onÊÇ¿ªÆôApacheµÄURLÖØд¹¦Ð§£»RewriteCond %{REQUEST_FILENAME} !-dºÍRewriteCond %{REQUEST_FILENAME} !-fÊÇɨ³ýµô»á¼ûÎļþºÍĿ¼µÄÇëÇó£¬×èÖ¹¶Ô¾²Ì¬×ÊÔ´µÄ»á¼ûÔì³ÉÓ°Ï죻×îºóRewriteRuleÓÃÓÚ½«URLÖ¸ÏòthinkPHPÈë¿ÚÎļþindex.php£¬²¢´øÉÏ·ÓÉÐÅÏ¢¡£

Èý¡¢¸½¼Ó¹¦Ð§

ÉèÖÃURLºó׺

ÎÒÃÇ¿ÉÒÔͨ¹ýÉèÖÃURLºó׺½øÒ»²½ÔöÇ¿Ó¦ÓõÄÇå¾²ÐÔ¡£ÀýÈ磬¿ÉÒÔ½«ËùÓеÄURLºó׺ÉèÖóÉ.shtml¡¢.html¡¢.shtmlµÈ£¬ÕâÑù¿ÉÒÔÓÐÓÃ×èÖ¹¶ÔÎÒÃǵÄÓ¦ÓÃÔì³É¹¥»÷¡£

¿ÉÒÔÔÚÉèÖÃÎļþÖУ¬ÕÒµ½url_html_suffixÑ¡Ïî²¢¼ÓÉÏÏìÓ¦µÄºó׺¼´¿É£¬ÀýÈ磺

'url_html_suffix'  =>  'shtml|html|htm'

µÇ¼ºó¸´ÖÆ

×Ô¶¯Ê¶±ðURL

ÔÚRouteÀàµÄregisterÒªÁìÖÐÌí¼ÓÒ»¸ö·ÓɹæÔò£¬ÒÔ±ã¿ò¼Ü¿ÉÒÔ×Ô¶¯ÆÊÎöURL¡£ÀýÈ磺

if (is_file(APP_PATH . 'route.php')) {
Route::get('/', 'index/index');
Route::get('build', 'index/build');
include_once APP_PATH . 'route.php';
}

µÇ¼ºó¸´ÖÆ

ÕâÑù£¬ÈôÊÇÓÐÇкϹæÔòµÄURL£¬½«×Ô¶¯×ª·¢µ½Æä¶ÔÓ¦µÄ¿ØÖÆÆ÷»ò²Ù×÷ÒªÁì¡£

ÒÔÉϾÍÊÇthinkPHP5ÖÐÔõôÒþ²ØÈë¿ÚÎļþµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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