Php pseudo-static solution

Source: Internet
Author: User
Php generates pseudo-static code. Does that guy generate php pseudo-static code? Let me see. Thank you! this is the pseudo-static generation code PHPcode/*** rewrite URL address of ecshop ** @ accesspublic * @ paramstring $ app execution program * @ parama php to generate pseudo-static
Does that dude generate php pseudo-static code? Let me see. Thank you!

------ Solution --------------------
This is the pseudo-static generation code of ecshop.
PHP code
/*** Rewrite URL address ** @ access public * @ param string $ app execution program * @ param array $ params parameter array * @ param string $ append additional string * @ param integer $ page number * @ return void */function build_uri ($ app, $ params, $ append = '', $ page = 0, $ size = 0) {static $ rewrite = NULL; $ append = str_replace (':','', $ append); $ append = str_replace ('/', '', $ append); $ append = str_replace ('? ', '', $ Append); $ append = str_replace ('? ', '', $ Append); $ append = str_replace (','', $ append); $ append = str_replace ('"','', $ append); $ append = str_replace (':', '', $ append); $ append = str_replace ('#','', $ append ); $ append = str_replace (',', '', $ append); $ append = str_replace ('=','', $ append); $ append = str_replace (') ', '', $ append); $ append = str_replace (') ','', $ append); $ append = str_replace ('(','', $ append); $ append = str_replace ('(', '', $ Append); $ append = str_replace ('! ', '', $ Append); $ append = str_replace (' \ ','', $ append); $ append = str_replace ('... ', '', $ Append); $ append = str_replace ('. ','', $ append); $ append = str_replace ('. ', '', $ Append); $ append = preg_replace ('/(\ s +)/','-', $ append); // exit; if ($ rewrite = NULL) {$ rewrite = intval ($ GLOBALS ['_ CFG'] ['rewrite']);} $ args = array ('CID' => 0, 'gid' => 0, 'bid' => 0, 'Acid '=> 0, 'aid' => 0, 'Sid '=> 0, 'gbid' => 0, 'auid' => 0, 'sort' => '', 'order' => '',); extract (array_merge ($ args, $ params); $ uri = ''; switch ($ app) {case 'Category ': if (empty ($ cid) {return False;} else {if ($ rewrite) {$ uri = 'category -'. $ cid; if (isset ($ bid) {$ uri. = '-B '. $ bid;} if (isset ($ price_min) {$ uri. = '-min '. $ price_min;} if (isset ($ price_max) {$ uri. = '-max '. $ price_max;} if (isset ($ filter_attr) {$ uri. = '-attr '. urlencode ($ filter_attr);} if (! Empty ($ page) {$ uri. = '-'. $ page;} if (! Empty ($ sort) {$ uri. = '-'. $ sort;} if (! Empty ($ order) {$ uri. = '-'. $ order ;}} else {$ uri = 'Category. php? Id = '. $ cid; if (! Empty ($ bid) {$ uri. = '& brand = '. $ bid;} if (isset ($ price_min) {$ uri. = '& price_min = '. $ price_min;} if (isset ($ price_max) {$ uri. = '& price_max = '. $ price_max;} if (isset ($ filter_attr) {$ uri. = '& filter_attr = '. urlencode ($ filter_attr);} if (! Empty ($ page) {$ uri. = '& page ='. $ page;} if (! Empty ($ sort) {$ uri. = '& sort ='. $ sort;} if (! Empty ($ order) {$ uri. = '& order = '. $ order ;}} break; case 'Goods ': if (empty ($ gid) {return false;} else {$ uri = $ rewrite? 'DVD-'. $ gid: 'goods. php? Id = '. $ gid;} break; case 'brand': if (empty ($ bid) {return false;} else {if ($ rewrite) {$ uri = 'brand -'. $ bid; if (isset ($ cid) {$ uri. = '-C '. $ cid;} if (! Empty ($ page) {$ uri. = '-'. $ page;} if (! Empty ($ sort) {$ uri. = '-'. $ sort;} if (! Empty ($ order) {$ uri. = '-'. $ order ;}} else {$ uri = 'brand. php? Id = '. $ bid; if (! Empty ($ cid) {$ uri. = '& cat ='. $ cid;} if (! Empty ($ page) {$ uri. = '& page ='. $ page;} if (! Empty ($ sort) {$ uri. = '& sort ='. $ sort;} if (! Empty ($ order) {$ uri. = '& order = '. $ order ;}} break; case 'article _ cat': if (empty ($ acid) {return false;} else {if ($ rewrite) {$ uri = 'article _ cat -'. $ acid; if (! Empty ($ page) {$ uri. = '-'. $ page;} if (! Empty ($ sort) {$ uri. = '-'. $ sort;} if (! Empty ($ order) {$ uri. = '-'. $ order ;}} else {$ uri = 'article _ cat. php? Id = '. $ acid; if (! Empty ($ page) {$ uri. = '& page ='. $ page;} if (! Empty ($ sort) {$ uri. = '& sort ='. $ sort;} if (! Empty ($ order) {$ uri. = '& order = '. $ order ;}} break; case 'article': if (empty ($ aid) {return false;} else {$ uri = $ rewrite? 'Article-'. $ aid: 'Article. php? Id = '. $ aid;} break; case 'group _ buy': if (empty ($ gbid) {return false;} else {$ uri = $ rewrite? 'Group _ buy-'. $ gbid: 'group _ buy. php? Act = view & id = '. $ gbid;} break; case 'Auction': if (empty ($ auid) {return false;} else {$ uri = $ rewrite? 'Auction-'. $ auid: 'Auction. php? Act = view & id = '. $ auid;} break; case 'snatch': if (empty ($ sid) {return false;} else {$ uri = $ rewrite? 'Snatch-'. $ sid: 'Snatch. php? Id = '. $ sid;} break; case 'Search': break; default: return false; break;} if ($ rewrite) {if ($ rewrite = 2 &&! Empty ($ append) {if ($ app = 'Goods ') {$ uri = urlencode (preg_replace ('/[\. | \/| \? | & | \+ | \\\ | \' | "|,] +/','', $ Append )). '-'. $ uri;} else {$ uri. = '-'. urlencode (preg_replace ('/[\. | \/| \? | & | \+ | \\\ | \' | "|,] +/','', $ Append) ;}} $ uri. = '.html ';} if ($ rewrite = 2) & (strpos (strtolower (EC_CHARSET), 'utf ')! = 0) {$ uri = urlencode ($ uri);} return $ uri ;}

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.