开发者

Saving HTML in database

I have a page that is written in HTML, I want to add a \ before every " and remove them before writing the code to开发者_JAVA百科 the page.

How can I perform this?

NOTE: I use file_get_contents("file.php"); to get the contents of the file to be added to the database.


Use mysql_real_escape_string on any value you want to write to your database.


use addslashes() to add the \ and then stripslashes() to remove them again.

edit: pass in as parameter your html code for each function

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜