Pagination in php search

Source: Internet
Author: User
When searching by PAGE, PHP also wants to include the searched Chinese characters in the url. How can I encode and decode them so that the Chinese characters cannot be seen in the url and the search can be achieved at the same time. When searching by PAGE, PHP also wants to include the searched Chinese characters in the url. How can I encode and decode them so that the Chinese characters cannot be seen in the url and the search can be achieved at the same time.

Reply content:

When searching by PAGE, PHP also wants to include the searched Chinese characters in the url. How can I encode and decode them so that the Chinese characters cannot be seen in the url and the search can be achieved at the same time.

You can encode the URL multiple times.

Use the urlencode function to process Chinese Characters

Put it in the cookie...

Find a solution on the Internet:
Function myEncode ($ str ){

$ ArrReturn = array (); for ($ I = 0; $ I
  
   
= 'A') {// The letter $ arrReturn [] = chr (ord ($ char) + 10);} else {// a number // 0->, 1-> B, 2-> c, 3-> d // that is, chr (ord ($ char)-ord ('0') + ord ('A ')); // = chr (ord ($ char)-48 + 97) // = chr (ord ($ char + 49) $ arrReturn [] = chr (ord ($ char) + 49) ;}}return implode ('', $ arrReturn );
  

}
Echo myEncode ('apple ').'
'; // Oiilljogjojm

Function myDecode ($ str ){

$chinese=array();for($i=0;$i
  
   =107 ? chr(ord($char)-10):chr(ord($char)-49);    }    $chinese[]= chr(hexdec($arr[0].$arr[1]));}return implode('',$chinese);
  

}
Echo myDecode ('oelnkaofkfln'); // Apple
?>

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.