Php user-defined urlencode, urldecode function instance. Php user-defined urlencode and urldecode function examples this article mainly introduces php user-defined urlencode and urldecode functions. The example analyzes php string transcoding techniques and provides reference prices for php user-defined urlencode, urldecode function instance
This article mainly introduces php user-defined urlencode and urldecode functions. The example analyzes php string transcoding techniques and has some reference value. For more information, see
This example describes the php user-defined urlencode and urldecode functions. Share it with you for your reference. The details are as follows:
?
|
1
2
3
4
5
6
7
8
9
10
11
12
13 |
// Use the JavaScript ajaxObject function to transcode the string.
Function ajax_encode ($ str ){
$ Patern = array ("/%/", "/= /","/&/");
// % Must be the first item, and the replacement is in the order of items.
$ Rp = array ("% 25", "% 26", "% 3D ");
Return preg_replace ($ patern, $ rp, $ str );
}
// Inverse function
Function ajax_decode ($ str ){
$ Patern = array ("/% 25/", "/% 26/", "/% 3D /");
$ Rp = array ("%", "= ","&");
Return preg_replace ($ patern, $ rp, $ str );
}
|
I hope this article will help you with php programming.
This article mainly introduces php custom urlencode and urldecode functions. The example analyzes php string transcoding techniques and provides reference prices...