PHP头条
热点:

php addslashes() 函数,phpaddslashes函数


实例
在每个双引号(")前添加反斜杠:

<?php
$str = addslashes('ggg is the "dada" city in China.');
echo($str);
?>

addslashes() 函数返回在预定义字符之前添加反斜杠的字符串。

单引号(’)
双引号(")
反斜杠(\)
NULL

可用于为存储在数据库中的字符串以及数据库查询语句准备字符串

GET、POST 和 COOKIE 数据自动运行 addslashes()

可以使用函数 get_magic_quotes_gpc() 进行检测

addslashes(string)

要转义的字符串

运行实例
<?php
$str = "Who's da shu?";
echo $str . " This is not haha.<br>";
echo addslashes($str) . " This is safe in a database query.";
?>

Who's
Who\'s 

www.phpzy.comtrue/php/24047.htmlTechArticlephp addslashes() 函数,phpaddslashes函数 实例 在每个双引号(")前添加反斜杠: ?php$str = addslashes('ggg is the "dada" city in China.');echo($str);? addslashes() 函数返回在预定义字符之前添加反斜杠的字符...

相关文章

    暂无相关文章

PHP之友评论

今天推荐