PHP: processing method for obtaining the current URL path (applicable to multi-condition filtering list) and url Processing Method

Source: Internet
Author: User

PHP: processing method for obtaining the current URL path (applicable to multi-condition filtering list) and url Processing Method


<? Php/*** PHP: Obtain the function of the current url path and the SERVER variable * $ _ SERVER ["QUERY_STRING"] query (query) * $ _ SERVER ["REQUEST_URI"] URI required to access this page * $ _ SERVER ["SCRIPT_NAME"] contains the path of the current script * $ _ SERVER ["PHP_SELF"] the file name of the script being executed * applies to filtering multiple conditions in the list, for example: price, time, type, etc. * @ author liuxinming */header ("Content-type: text/html; charset = UTF-8 "); if ($ url_string = $ _ SERVER ['query _ string']) {/** strpos function returns the position where the string first appears in another string */$ url_string = substr ($ url_string, (st Rpos ($ url_string ,"? "); // Return? Subsequent string results: name = liuxinming & type = 1parse_str ($ url_string, $ url); // parse the returned string to the variable result: array ('name' => 'liuxin', 'type' => 1) foreach ($ url as $ field => $ value) {/** rawurlencode encodes a string into a URL-specific format */$ add [] = $ field. '= '. rawurlencode ($ value); if ($ field = 'name') {echo "filtering SQL conditions by name field ";}//.... perform different URL filtering based on various situations // then assemble the multi-condition query conditions selected by the current user. // then assemble the flip URL // finally, a multi-condition filtering list is completed, the general logic is like this. If anything is wrong, please kindly advise.}?>

The above PHP method for obtaining the current URL path (applicable to the multi-Filter list) is all the content shared by the editor. I hope you can give it a reference, we also hope that you can support the customer's home.

Related Article

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: 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.