Home > Backend Development > PHP Tutorial > A brief introduction to PHP anti-injection

A brief introduction to PHP anti-injection

不言
Release: 2023-03-22 15:36:01
Original
1153 people have browsed it

This article mainly shares with you the anti-annotation of PHP. The article mainly introduces the code for anti-annotation of PHP. I hope it will be helpful to everyone.

$_POST = sql_injection($_POST); 
$_GET = sql_injection($_GET); 

function sql_injection($content) 
{ 
if (!get_magic_quotes_gpc()) { 
if (is_array($content)) { 
foreach ($content as $key=>$value) { 
$content[$key] = addslashes($value); 
} 
} else { 
addslashes($content); 
} 
}  
return $content; 
}
Copy after login

Related recommendations:

Simple php anti-injection code

Simple php anti-injection code

The above is the detailed content of A brief introduction to PHP anti-injection. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template