background
When writing the code, I encountered a strange problem: the card and coupon decoding interface of the applet always reported that the decoding failed. After searching for an hour, I found that the url parameter was filtered out by the I method of thinkphp, and it involved PHP's native $ _GET
reason
The bottom layer of the I method is the native $_GET, and $_GET will use url_decode() to process the parameters first, and url_decode() will turn "+" into a space, as shown in the figure:
Solution
Write your own method to replace spaces back to "+"
private function convertSapceToPlus($str)
{
return str_replace(' ','+',trim($str));
}