JSON - slashes not escaping
This is my PHP/Json script:
<?php
header('Content-type: application/json; charset=utf-8');
header("access-control-allow-origin: *");
$link = mysql_pconnect("localhost", "test", "test") or die("Could not
connect");
mysql_select_db("news") or die("Could not select database");
$arr = array();
$rs = mysql_query("SELECT * FROM stories");
while($obj = mysql_fetch_object($rs)) {
$arr[] = $obj;
}
echo '{"success":true,"error":"","data":[{"schedule":'.json_encode
($arr,JSON_UNESCAPED_SLASHES).']}}';
*/
?>
The JSON displays properly; however, despite using JSON_UNESCAPED_SLASHES
apostrophes still show, e.g.
It's a test!
when it should be: It/'s a test!
How can I get this to work properly?
No comments:
Post a Comment