尊龙凯时人生就是搏

thinkphpα¾²Ì¬ÔõôʵÏÖ

α¾²Ì¬£¨urlÖØд£©ÊÇÒ»ÖÖ½«¶¯Ì¬Íøַת»»Îª¾²Ì¬ÍøÖ·µÄÊÖÒÕ¡£Ëü¿ÉÒÔ½«ÀàËÆÓÚ”index.php?moduleid=1&catid=2&id=3″ÕâÑùµÄurlת»»ÎªÀàËÆÓÚ”/moduleid/1/catid/2/id/3.html”µÄ¾²Ì¬Á´½Ó¡£ÕâÖÖÒªÁìµÄÀûÒæÊÇ¿ÉÒÔÌá¸ßËÑË÷ÒýÇæµÄÓѺÃÐÔºÍÓû§µÄä¯ÀÀÌåÑé¡£ÔÚthinkphp¿ò¼ÜÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÉèÖÃα¾²Ì¬¹æÔòÀ´ÊµÏÖÕâ¸öЧ¹û¡£

ÏÂÃ棬ÎÒÃÇÀ´ÏêϸÏÈÈÝÒ»ÏÂÔõÑùÔÚThinkPHPÖÐʵÏÖα¾²Ì¬¡£

Ò»¡¢¿ªÆô·ÓÉ

ÔÚThinkPHPÖпªÆô·ÓÉÐèÒªÔÚconfig.phpÎļþÖоÙÐÐÉèÖá£Ê×ÏÈ£¬ÎÒÃÇÐèÒªÕÒµ½ÒÔÏ´úÂ룺

// Ä¬ÈÏ¿ØÖÆÆ÷Ãû
'controller_suffix'      => false,
// Õ¥È¡»á¼ûµÄÄ£¿éÁÐ±í£¨Ð¡Ð´£©
'deny_module_list'       => ['common'],
// Ä¬ÈÏÊä³öÀàÐÍ
'default_return_type'    => 'html',
// Ä¬ÈÏAJAX Êý¾Ý·µ»ØÃûÌÃ,¿ÉÑ¡json xml ...
'default_ajax_return'    => 'json',
// Ä¬ÈÏJSONPÃûÌ÷µ»ØµÄ´¦ÀíÒªÁì
'default_jsonp_handler'  => 'jsonpReturn',
// Ä¬ÈÏJSONP´¦ÀíÒªÁì
'var_jsonp_handler'      => 'callback',

µÇ¼ºó¸´ÖÆ

È»ºó£¬½«ÆäÖеÄ·ÓÉÉèÖÃÏîµÄ×¢ÊÍ×÷·Ïµô£¬¼´¿É¿ªÆô·ÓÉ¡£

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

// ¿ªÆô·ÓÉ
'url_route_on'  => true,
// Â·ÓÉʹÓÃÍêÕûÆ¥Åä
'url_route_must'=> false,

µÇ¼ºó¸´ÖÆ

¶þ¡¢ÉèÖÃα¾²Ì¬¹æÔò

¿ªÆô·Óɺó£¬ÎÒÃDzſÉÒÔÉèÖÃα¾²Ì¬¹æÔò¡£ÎÒÃÇÐèÒªÔÚroute.phpÎļþÖоÙÐÐÉèÖá£Ê×ÏÈ£¬ÎÒÃÇÐèÒªÕÒµ½ÒÔÏ´úÂ룺

return [
    '__pattern__' => [
        'name' => '\w+',
    ],
    '[hello]'     => [
        ':id'   => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
        ':name' => ['index/hello', ['method' => 'post']],
    ],
];

µÇ¼ºó¸´ÖÆ

È»ºó£¬ÎÒÃÇ¿ÉÒÔ×Ô½ç˵α¾²Ì¬¹æÔò£¬½«¶¯Ì¬Á´½Óת»»³É¾²Ì¬Á´½Ó¡£

¼ÙÉèÎÒÃÇÏëÒª½«”index.php?moduleid=1&catid=2&id=3″ת»»Îª”/moduleid/1/catid/2/id/3.html”£¬ÎÒÃÇ¿ÉÒÔÕâÑùÉèÖãº

'__pattern__' => [
    'name' => '\w+',
],
'__alias__' => [
    'moduleid/1/catid/2/id/3.html' => 'index.php?moduleid=1&catid=2&id=3',
],

µÇ¼ºó¸´ÖÆ

ÕâÑù¾ÍÍê³ÉÁËα¾²Ì¬¹æÔòµÄÉèÖá£

Èý¡¢ÆôÓÃα¾²Ì¬

ÉèÖúÃα¾²Ì¬¹æÔòÖ®ºó£¬ÎÒÃÇ»¹ÐèÒªÐÞ¸ÄApache»òNginxЧÀÍÆ÷µÄÉèÖÃÎļþ£¬ÆôÓÃα¾²Ì¬¡£ÒÔApacheЧÀÍÆ÷ΪÀý£¬ÎÒÃÇÐèÒªÔÚ.htaccessÎļþÖÐÌí¼ÓÒÔÏ´úÂ룺

<ifmodule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</ifmodule>

µÇ¼ºó¸´ÖÆ

ÕâÑù¾ÍÍê³ÉÁËα¾²Ì¬µÄÉèÖá£

ËÄ¡¢²âÊÔα¾²Ì¬

ÆôÓÃα¾²Ì¬Ö®ºó£¬ÎÒÃÇ¿ÉÒÔÔÚä¯ÀÀÆ÷ÖÐÊäÈë”/moduleid/1/catid/2/id/3.html”£¬¿´¿´ÊÇ·ñÄܹ»Õý³£»á¼ûµ½Ò³Ãæ¡£ÈôÊÇÄܹ»Õý³£»á¼û£¬ËµÃ÷α¾²Ì¬ÒѾ­ÉúЧ¡£

×ܽá

ͨ¹ýÒÔÉÏ°ì·¨£¬ÎÒÃÇ¿ÉÒÔÇáËÉʵÏÖα¾²Ì¬µÄ¹¦Ð§¡£ÔÚ¿ª·¢ÖУ¬ÎÒÃÇÐèҪƾ֤¹æ·¶ÉèÖ÷ÓɺÍα¾²Ì¬¹æÔò£¬Àû±ãËÑË÷ÒýÇæץȡҳÃ棬Ìá¸ßÓû§µÄä¯ÀÀÌåÑé¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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