Home > Article > Backend Development > Ask about escaping addslashes_PHP tutorial
Please tell me about the escaping of addslashes
Please tell me about addslashes
1. When I enter Tom's book's to save data
$webname = addslashes($_POST['name']);
2..The data I saw when I opened the database was Tom's book's
3. My question is how to output,
I use name ?>
when outputting
Output results Tom's book's
Please tell me how to make it display without / and make it display as Tom's book's
4..Thank you..
$str='Tom's book's';
echo ereg_replace("^(['|"|,|.])",'1',$str)
?>
You may have turned on magic string, it will automatically change your mind
And you turned it around again, and it became like that
[url=http://cn.php.net/manual/zh/security.magicquotes.php]Link tag http://cn.php.net/manual/zh/security.magicquotes.php[/url]
Learn
Go back to the 2nd floor..
According to your method...if I have many fields added to the database, I add addslashes
Then when outputting, each field must be added?
addslashes is to add escape "/" to the characters on the page
Stripslashes remove escaping
Insert: $name=$_POST['name'];
$name=addslashes($name);
Show $name=stripslashes($row['name]);
LS is the correct answer
POST itself will be escaped once during the transmission process..
Thank you to everyone upstairs...[img]http://www.111cn.cn/bbs/images/smilies/default/tongue.gif[/img] Come here...let me kiss you one by one![img]http ://www.111cn.cn/bbs/images/smilies/default/kiss.gif[/img]
I don’t understand why mysql_real_escape_string
is not used