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
?>