PH编程中,处理提交数据并过滤非法字符防注入的方法.
插入数据时用addslashes()就好了,其他的再根据需要进行处理。
不管magic_quotes_gpc是On还是Off,添加数据时都用addslashes(),当On时,必须使用stripslashes(),Off时则不能用stripslashes()。
//提交数据,或者变量准备:
$Content=addslashes("这里面是数据,不管有没单引号或者还是变量");
//插入数据到数据库,代码省略
//开始显示数据
$Content="从数据库读取的数据";
if(get_magic_quotes_gpc()){ $Content=stripslashes($Content); }

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6
Visual web development tools

Dreamweaver Mac version
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools
