When using ThinkPHP to make tags, a problem arises, that is, the parameters can be obtained, but the corresponding results cannot be found. Looking at the database, you find that the data exists. What's the problem?
Calls like http://tags/index/%E8%87%AA%E5%8A%A8%E9%AA%8C%E8%AF%
The parameters are encoded by urlencode(), and the urldecode() function is used for decoding, and then querying still has no results.
Then I tested the conversion coded iconv() function, and the result was successful.
The default encoding of the browser is GB2312, while this project uses UTF-8 encoding.
Here are the wrong code and the corrected code:
$kw= $_GET['_URL_']['2']; //The wrong code, parameters that can be obtained on iis, but the result cannot be found.$kw= iconv("gb2312","utf-8",$_GET['_URL_']['2']); //Encoded converted,Can query results。
in addition,This method is only applicable to the IIS environment。
Also pay attention,When $_GET receives parameters, it has the urldecode transcoding function, and there is no need to perform urldecode decoding operations!