×ðÁú¿­Ê±¹ÙÍøµÇ¼

thinkphp·Óɲ»×ª»»ÎÊÌâÔõÑù½â¾ö

Ò»¡¢ÎÊÌâÐÎò

ÔÚÎÒÃÇʹÓÃThinkPHP¾ÙÐпª·¢Ê± £¬ÓÐʱ»áÓöµ½ÕâÑùµÄÇéÐΣºµ±ÎÒÃǾÙÐÐһЩ·ÓɲÙ×÷ʱ £¬Ò³Ã沢δÌøתÖÁÎÒÃÇËùÆÚÍûµÄ½çÃæ ¡£

ÀýÈç £¬ÎÒÃÇÏ£Íûͨ¹ýURL¡°www.example.com/home/do¡±À´»á¼û¡°HomeController.php¡±Öеġ°do¡±ÒªÁì £¬µ«ÎÒÃÇÏÖʵÉÏÈ´ÎÞ·¨»á¼ûµ½´ËÒªÁì ¡£Í¬Ê± £¬ÎÒÃÇ·¢Ã÷²¢Ã»Óб¨´íÐÅÏ¢·ºÆ𠣬Õâ¾ÍÈÃÎÒÃÇÎÞ´ÓÏÂÊÖ ¡£

¶þ¡¢Ôµ¹ÊÔ­ÓÉÆÊÎö

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

ÔÚThinkPHPÖÐ £¬Â·ÓÉÊÇͨ¹ýURLºó׺¾ÙÐÐÆ¥ÅäµÄ ¡£ÈôÊÇÔÚÎÒÃǵÄURLÖÐûÓÐʹÓÃÈκκó׺ £¬ÄÇôThinkPHP½«ÒÔΪÎÒÃÇÒª»á¼ûµÄÒªÁìÊÇ¿ØÖÆÆ÷ÖеÄĬÈÏÒªÁ죨ĬÈÏÒªÁìÃûÒ»Ñùƽ³£Îª¡°index¡±£© ¡£

ÀýÈç £¬ÎÒÃÇʹÓÃURL¡°www.example.com/home/index¡±Ê± £¬¾Í»áĬÈÏ»á¼û¡°HomeController.php¡±Öеġ°index¡±ÒªÁì ¡£

¶øµ±ÎÒÃÇʹÓÃURL¡°www.example.com/home/do¡±Ê± £¬ÓÉÓÚûÓÐʹÓÃÈκκó׺ £¬ThinkPHP¾Í»áÒÔΪÎÒÃÇÒª»á¼ûµÄÊÇ¡°index¡±ÒªÁì £¬Í¬Ê±ÓÉÓÚ¡°do¡±ÒªÁì²¢²»±£´æÓÚ¿ØÖÆÆ÷ÖÐ £¬ÒÔÊǾͻᵼÖÂÒ³Ãæ»á¼ûʧ°Ü ¡£

Èý¡¢½â¾öÒªÁì

1.ʹÓá°/¡±ºó׺

ÈôÊÇÔÚURLĩβÌí¼Óб¸Ü¡°/¡± £¬¾Í¿ÉÒÔ×èÖ¹·ºÆð·Óɲ»Æ¥ÅäµÄÇéÐÎ ¡£ÀýÈç £¬ÎÒÃÇ¿ÉÒÔʹÓÃURL¡°www.example.com/home/do/¡±À´»á¼û¡°HomeController.php¡±Öеġ°do¡±ÒªÁì ¡£

ͬʱ £¬ÎÒÃÇÔÚʹÓÃThinkPHP¾ÙÐпª·¢Ê± £¬ÍƼöÔÚÉèÖÃÎļþconfig.phpÖн«URLºó׺ÉèÖÃΪ¡°/¡± £¬ÕâÑù¿ÉÒÔ×èÖ¹·ºÆð·Óɲ»×ª»»µÄÎÊÌâ ¡£

2.Ð޸ķÓɹæÔò

ÎÒÃÇÒ²¿ÉÒÔͨ¹ýÐ޸ķÓɹæÔòÀ´½â¾öÎÊÌâ ¡£

Ê×ÏÈ £¬ÔÚÎÒÃǵÄ·ÓÉÉèÖÃÎļþÖУ¨Ò»Ñùƽ³£Îªroute.php£© £¬ÎÒÃÇ¿ÉÒÔ½«Â·ÓɹæÔò½ç˵Ϊ£º

return [
    'home/do/[:id]' => 'home/[:action]',
];

µÇ¼ºó¸´ÖÆ

ÕâÑù £¬ÎÒÃǾͿÉÒÔͨ¹ýURL¡°www.example.com/home/do/1¡±À´»á¼û¡°HomeController.php¡±Öеġ°do¡±ÒªÁì £¬²¢ÔÚURLÖÐת´ïÒ»¸öid²ÎÊý ¡£

ÒÔÉϾÍÊÇthinkphp·Óɲ»×ª»»ÎÊÌâÔõÑù½â¾öµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

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

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

QR code
ÍøÕ¾µØͼ