thinkphpÍøÖ·Òþ²ØÄ£¿éÔõÑùʵÏÖ
ÓÐʱÔÚÍøÕ¾¿ª·¢ÖУ¬ÐèÒªÒþ²ØÒ³ÃæµÄÏÖʵÍøÖ·£¬ÒÔ±ÜÃâÓû§»ñÈ¡µ½¡£ÎªÏàʶ¾öÕâ¸öÎÊÌ⣬thinkphpÌṩÁËÒ»¸öÍøÖ·Òþ²ØµÄÄ£¿é¡£
Õâ¸öÄ£¿éµÄʵÏÖ·½·¨ÊÇͨ¹ýÖØдURLµÄÐÎʽʵÏֵġ£µ±Óû§ÇëÇóÒ»¸öURLʱ£¬ÏµÍ³»á×Ô¶¯½«URL¾ÙÐÐÖØд£¬²¢ÇÒ·µ»Øµ½Ç°¶ËÒ³Ãæ¡£Òò´Ë£¬Óû§ÎÞ·¨Ö±½Ó»á¼ûµ½ÕæʵµÄURLµØµã¡£
ΪÁËʹÓÃÕâ¸öÄ£¿é£¬ÄãÐèÒªÔÚÉèÖÃÎļþÖоÙÐÐһЩÐ޸ġ£Ê×ÏÈ£¬ÄãÐèÒª¿ªÆôURLÖØд¹¦Ð§¡£Ä¬ÈÏÇéÐÎÏ£¬thinkphp¿ò¼Ü²»ÆôÓÃURLÖØд¹¦Ð§£¬ÐèÒªÊÖ¶¯¿ªÆô¡£ÔÚÉèÖÃÎļþÖУ¬ÄãÐèÒªÌí¼ÓÈçÏÂÉèÖãº
'URL_MODEL' => 2, //¿ªÆôRewriteģʽ 'URL_ROUTER_ON' => true, //¿ªÆô·Óɹ¦Ð§ 'URL_ROUTE_RULES' => array( //½ç˵·ÓɹæÔò ),
µÇ¼ºó¸´ÖÆ
½ÓÏÂÀ´£¬ÄãÐèÒª½ç˵һЩ·ÓɹæÔò¡£Â·ÓɹæÔòÊÇÖ¸½«URL¾ÙÐÐÖØдµÄ¹æÔò¡£ÀýÈ磬Óû§»á¼ûhttp://www.example.com/article/1£¬ÏÖʵÉÏŲÓõÄÊÇhttp://www.example.com/index.php?s=/home/article&id=1¡£
Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
½ç˵·ÓɹæÔòºÜ¼òÆÓ£¬Ö»ÐèÒªÔÚÉèÖÃÎļþÖÐÌí¼ÓÈçÏ´úÂ룺
'URL_ROUTE_RULES' => array( 'article/:id' => 'home/article', ),
µÇ¼ºó¸´ÖÆ
Õâ¸ö¹æÔòµÄÒâ˼ÊÇ£¬½«http://www.example.com/article/1Õâ¸öURLÖØдΪhttp://www.example.com/index.php?s=/home/article&id=1¡£ÆäÖУ¬:idÌåÏÖÒ»¸ö±äÁ¿£¬¿ÉÒÔÆ¥Åäí§ÒâÒ»¸öÊý×Ö¡£
ÓÐÁËÕâЩÉèÖã¬ÎÒÃǾͿÉÒÔ×îÏÈʹÓÃÍøÖ·Òþ²ØÄ£¿éÁË¡£ÈôÊÇÏëÒªÒþ²ØÎÄÕÂÁбíÒ³ÃæµÄURL£¬¿ÉÒÔ½ç˵һ¸ö·ÓɹæÔòÀ´ÊµÏÖ£¬ÈçÏÂËùʾ£º
'URL_ROUTE_RULES' => array( 'articles' => 'home/article/lists', ),
µÇ¼ºó¸´ÖÆ
Õâ¸ö¹æÔòµÄÒâ˼ÊÇ£¬½«http://www.example.com/articlesÕâ¸öURLÖØдΪhttp://www.example.com/index.php?s=/home/article/lists¡£Óû§»á¼ûhttp://www.example.com/articlesʱ£¬ÏµÍ³»á×Ô¶¯½«URLÖØдΪhttp://www.example.com/index.php?s=/home/article/lists£¬²¢·µ»Øµ½Ç°¶ËÒ³Ãæ¡£
¿ÉÒÔ¿´µ½£¬Ê¹ÓÃthinkphpµÄÍøÖ·Òþ²ØÄ£¿éºÜÊǼòÆÓ¡£Í¨¹ý¼òÆÓµÄÉèÖã¬ÎÒÃÇ¿ÉÒÔÒþ²ØÍøÖ·£¬´Ó¶ø°ü¹ÜÍøÕ¾µÄÇå¾²ÐÔºÍÓû§µÄÒþ˽¡£
ÒÔÉϾÍÊÇthinkphpÍøÖ·Òþ²ØÄ£¿éÔõÑùʵÏÖµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡