Problems with PHP search paging

Source: Internet
Author: User
PHP in the search page, want to search the Chinese characters are also included in the URL, how to encode and decode, so that the URL can not see the Chinese characters, at the same time to achieve the purpose of the search.

Reply content:

PHP in the search page, want to search the Chinese characters are also included in the URL, how to encode and decode, so that the URL can not see the Chinese characters, at the same time to achieve the purpose of the search.

You can urlencode code multiple times, and you won't see it.

Processing Chinese characters using the UrlEncode function

Put it in a cookie ...

Find a solution on the Web:
function Myencode ($STR) {

$arrReturn=array();for($i=0;$i
  
   
    
   ='a'){//是字母            $arrReturn[]=chr(ord($char)+10);        }else{            //是数字            //0->a,1->b,2->c ,3->d            //即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.