首页 > PHP教程 > PHP常用函数手册 > PHP String 函数

PHP addslashes() 函数

 函数原型

/**

 * 在预定义的字符前添加反斜杠的字符串,这些字符是单引号(')、双引号(")、反斜线(\)与 NUL(NULL 字符)

 * @link http://php.net/manual/en/function.addslashes.php

 * @param string $str  要转义的字符

 * @return string  已转义的字符串

 * @since 4.0

 * @since 5.0

 */

function addslashes ($str) {}

 

函数示例

<?php 

$str = addslashes('hello "world"');

echo  $str;  //输出hello \"world\"

?>

关闭
感谢您的支持,我会继续努力!
扫码打赏,建议金额1-10元


提醒:打赏金额将直接进入对方账号,无法退款,请您谨慎操作。