I have a PHP Array with the word 's morgens
in it. I'm using a function which escapes the single quote, json_encode()
adds another backslash to it which causes an error in the SQL code. The parameter JSON_UNESCAPED_SLASHES
causes the following error:
Warning: json_encode() expects parameter 2 to be long, string given
The output is as follows, before json_encode():
string(11) "\'s middags"
And after json_encode():
"\\'s middags"
Its equivalent (long, 64) won't work, it doesn't throw an error. How can I prevent json_encode()
from adding a backslash?
(Sorry for bad English, it's not my native language)
No comments:
Post a Comment