PHP single and double quotation marks can modify the string type of data, if the decorated string contains variables (example $name), the biggest difference is: Double quotation marks will replace the value of the variable, and the single quotation marks it as a string output.
PHP JSONP output is generally in the following format:
Callbackname (' JSON string ');
If the middle JSON string contains single quotes, this output is problematic and the caller is generally unable to handle it, so we want to escape the single quotes.
If it is generated in Json_encode mode, it can be escaped in the following way:
$ret = Json_encode ($result,header(' Content-type:text/javascript; charset= Utf-8 'echo$callback$ret . '\');';
Here Json_hex_apos is PHP is provided to the single quote to \u0027.
If it is a string concatenation, you can use the following method:
$jsonData Preg_replace $jsonData);
and then output.
The above describes the PHP jsonp single-quote escape, including the Jsonp single-quote escape, I hope the PHP tutorial interested in a friend helpful.