Urlencode has a strange problem. I would like to use the urlencode function of php to output the string "(baidu) % e4 % b8 % ad" but the actual output is as follows: % 28% 27 baidu % 27% 29. I search for keywords in baidu: online url encoding. the third result is a url encoding applet of the baidu application, in that case, you can use utf8 encoding to output the following: (baidu) % e4 % urlencode.
I want to use the urlencode function of php to output the string "('baidu')" ('baidu') % e4 % b8 % ad
But actually output: % 28% 27 baidu % 27% 29,
I search for keywords in Baidu: online url encoding. the third result is: a url encoding applet of the Baidu application, which can be output using utf8 encoding:
('Baidu') % e4 % b8 % ad. why?
Of course, it doesn't matter if the Chinese character "medium" in the string is generated differently, because my source code is utf8, so I am wondering how to make php
Does the urlencode () function not encode commas and parentheses?
------ Solution --------------------
String urlencode (string $ str)
Returns a string -_. all other non-alphanumeric characters will be replaced with a semicolon (%) followed by two hexadecimal numbers, and spaces will be encoded as the plus sign (+ ).
Baidu is not strict. if you do not want transcoding parentheses, you can use str_replace ('% 28',' (', $ enstr) to replace the transcoding result.
------ Solution --------------------
Baidu is inaccurate. I used it.