search
Homephp教程php手册请教关于addslashes的转义




请教关于addslashes的转义

请教关于addslashes
1. 我输入 Tom's book's 保存数据时
$webname = addslashes($_POST['name']);

2..我打开数据库看到的数据为 Tom's book's

3. 我的问题是如何输出,
输出时我用的是name ?>
输出结果Tom's book's
请问如何让它显示不含/,让它显示为 Tom's book's

4..谢谢..




$str='Tom's book's';
echo ereg_replace("^(['|"|,|.])",'\1',$str)
?>

你可能是打开了magic string, 它会自动给你转意
而你自己又转了一下, 就成了那样了
[url=http://cn.php.net/manual/zh/security.magicquotes.php]链接标记http://cn.php.net/manual/zh/security.magicquotes.php[/url]

学习

回2楼..
按你那个方式..如果我有很多字段入库时都加了addslashes

那么输出时,每个字段都要加啊?

addslashes是把页面的字符加上转义“/”
stripslashes是去掉转义

插入:$name=$_POST['name'];
$name=addslashes($name);
显示 $name=stripslashes($row['name]);

LS才是正解

POST本身就是传递过程中会转义一次..

感谢楼上的各位筒子..[img]http://www.111cn.cn/bbs/images/smilies/default/tongue.gif[/img] 过来..让偶一个一个亲一下![img]http://www.111cn.cn/bbs/images/smilies/default/kiss.gif[/img]

搞不懂为什么不用mysql_real_escape_string

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),