Writing CKEditor edited HTML file from PHP -
i'm using ckeditor , want save html edited file. in order so, utilize next code:
if (isset($_post['editor']) && !empty($_post['editor'])) { $data = $_post['editor']; $path = "uploads/".generaterandomstring().".html"; $file = fopen($path, "w"); fwrite($file, $data); fclose($file); }
the problem if edit in editor , source code is:
<p><img alt="" src="http://zns.india.com/upload/2013/12/29/pitbull319.jpg" style="height:351px; width:319px" /></p>
when save file, source code turns out be:
<p><img alt="\"\"" src="\"http://zns.india.com/upload/2013/12/29/pitbull319.jpg\"" style="\"height:351px;" width:319px\"=""></p>
i guess it's formatting issue don't know how solve it. trying replace \"
(which deisplayed \"
) stills doesn't identical.
i appreciate kind of advice. in advance!
i solved using stripslashes()
function. $data = stripslashes($_post['editor']);
the problem in magic_quotes
php automatically enables. all!
php html format save ckeditor
No comments:
Post a Comment