stripcslashes 不仅跳过 C 风格的转义序列 \a、\b、\f、\n、\r、\t 和 \v,而是将它们转换为实际含义。
因此
<?php
stripcslashes('\n') == "\n"; //true;
$str = "we are escaping \r\n"; //we are escaping
?>
string
要取消转义的字符串。
返回取消转义的字符串。
示例 #1 stripcslashes() 示例
<?php
var_dump(stripcslashes('I\'d have a coffee.\nNot a problem.') === "I'd have a coffee.
Not a problem."); // true
?>
stripcslashes 不仅跳过 C 风格的转义序列 \a、\b、\f、\n、\r、\t 和 \v,而是将它们转换为实际含义。
因此
<?php
stripcslashes('\n') == "\n"; //true;
$str = "we are escaping \r\n"; //we are escaping
?>
您可能需要执行两次 stripslashes 以完全删除三个连续的斜杠
$stripped = 'this is a string with three\\\ slashes';
$stripped = stripslahses($stripped);
将输出
'this is a string with three\ slashes'
$stripped = 'this is a string with three\\\ slashes';
$stripped = stripslahses(stripslashes($stripped));
将输出
'this is a string with three slashes'