Rewrite the thinkphp u method so that it routes down the page under normal _php tutorial

Source: Internet
Author: User
ThinkPHP3.1.3 in the case of enabling routing, its paging address is not the address of the route, because the thinkphp3.2.1 code is not fixed, many people have encountered this problem, this article adopts olcms modification method to solve this problem, especially thanks to Phper Jack's contribution to this, the specific solution is to modify the thinkphp functions.php U method, in 287 rows or so:

if (!empty ($vars)) {  //Add parameter foreach ($vars as $var = = $val) {if ('!== trim ($val)) $url. = $depr. $var. $depr. u Rlencode ($val); }

Add the following code later

/** TP Open route Next page Routing failure Problem page class URL assembly *//If the route is turned on (C (' url_router_on ')) {foreach (C (' Url_route_rules ') as $zhaolg + = $zlig) {//Traverse route if (strstr ('/').      Group_name. $url, $zlig)) {//Find routing rules from urls $lg = strstr ($zhaolg, '/: ');//analysis rule with parameters?         if ($LG) {//If the rule has parameters $tempzlg = Str_replace ('/: ', ' ', $LG);//Take parameter//dump ($TEMPZLG); if ($TEMPZLG) {if (C (' App_sub_domain_deploy ')) {$zlgurl = Str_replace ($zlig, $zhaolg, '/'). Group_name. $url);                          The URL is replaced by the routing rule}else{$zlgurl = Str_replace ($zlig, $zhaolg, $url);//url is replaced by the routing rule}          Note/s/:c/c/4/p/__page__//dump ($zlgurl);        $url = Str_replace ($lg. '/'. $tempzlg, ', $zlgurl);//url replace route rule parameters}}else{//analysis rule without parameters if (C (' App_sub_domain_deploy ')) {$url = Str_replace ($zlig, $zhaolg, '/').         Group_name. $url);//url Replace with routing rule}else{$url = Str_replace ($zlig, $zhaolg, $url);//url Replace with routing rules}                }    }  } } 

This solves the problem!

http://www.bkjia.com/PHPjc/824664.html www.bkjia.com true http://www.bkjia.com/PHPjc/824664.html techarticle ThinkPHP3.1.3 in the case of enabling routing, its paging address is not the address of the route, because thinkphp3.2.1 code is not fixed, many people have encountered this problem, this article adopted OLCM ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.