我对这个越来越模糊了:P
function escape($string)
{
$string = stripslashes($string);
if (function_exists('mysql_real_escape_string')) {
return mysql_real_escape_string($string, $this->connection);
} else {
return mysql_escape_string($string);
}
}
$content = '""""""test\'te%%%%st`test_huhu\'_';
echo '<br>output 1 = '.stripslashes($content);
echo '<br>output 2 = '.$db->escape($content);
输出
output 1 = """"""test'te%%%%st`test_huhu'_
output 2 = \"\"\"\"\"\"test\'te%%%%st`test_huhu\'_
如何制作output 2
将是一样output 1
的,为什么output 2
会这样?