我目前有PHP代码从数据库中获取一些html,然后将其作为JSON传递给jquery,它解析JSON。直到那一刻一切都很好。但是,如果您随后在TinyMCE中更改了某些样式,则会将其作为样式附加到元素上。 (例如<h1 style="font-weight:bold">
)
下次脚本尝试检索此内容时,由于双撇号,JSON无法解析。有没有办法让TinyMCE不使用双撇号?
使用某些实际代码进行编辑
PHP Storer:
$conn = mysql_connect($row['ipdb'],$row['usernamedb'], $row['wwdb']) or die("err");
$db = mysql_select_db($row['usernamedb']) or die("err");
$id = $_POST['id'];
$column = $_POST['column'];
$page = $_POST['page'];
$value = $_POST['value'];
$qry = "UPDATE ".$page." SET ".$column."='$value' WHERE id='$id'";
$result = mysql_query($qry) or die("An error occurred ".mysql_error());
PHP Fetcher:
$conn = mysql_connect($row['ipdb'],$row['usernamedb'], $row['wwdb']) or die("err");
$db = mysql_select_db($row['usernamedb']) or die("err");
$identifier = $_POST['identifier'];
$page = $_POST['page'];
$qry = "SELECT id, textnl, texten FROM ".$page." WHERE identifier='$identifier'";
$result = mysql_query($qry) or die("An error occurred ".mysql_error());
$obj = mysql_fetch_object($result);
$textnl = $obj->textnl;
$texten = $obj->texten;
$id = $obj->id;
echo '{ "textnl" : "' . $textnl . '", "texten" : "' . $texten . '", "id" : "' . $id . '" }';
答案 0 :(得分:0)
尝试使用stripslashes http://www.php.net/manual/es/function.stripslashes.php。也许可以帮到你。