开发者

Saving HTML in database

开发者 https://www.devze.com 2023-01-26 06:09 出处:网络
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.

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

精彩评论

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