Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当上传文本文件并读取数据以保存在 PHP 中的数据库中时。像这样使用时,它会附加\0每个字符addslashes:
\0
addslashes
$city=trim(addslashes($row[7]));
如果你的文件中有多字节字符addslashes只会破坏你的编码。
如果您想在将字符串插入数据库或任何其他适当的库之前对其进行mysqli_real_escape_string转义PDO。
mysqli_real_escape_string
PDO