Why does JSON encoder adds escaping character when encoding URLs?

后端 未结 5 2054
太阳男子
太阳男子 2020-12-17 17:15

I am using json_encode in PHP to encode an URL

$json_string = array (\'myUrl\'=> \'http://example.com\');
echo json_encode ($json_string);
         


        
5条回答
  •  情歌与酒
    2020-12-17 17:48

    If you are using php 5.4 you can use json_encode options. see the manual.

    Several options added in php 5.3 but JSON_UNESCAPED_SLASHES in 5.4.

提交回复
热议问题