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.
我在 cakePHP 中使用 Sanitize::clean 来清理用户输入,结果我得到了“\r”字符。
“\r”是回车符(打印到控制台时,会导致输出从下一行开始,但不影响网页的显示)。
trim($userInput);您可以通过调用或使用以下方式摆脱此角色(和其他角色)Sanitize::clean:
trim($userInput);
Sanitize::clean
$opts = array('carriage'=>true); $cleaned = Sanitize::clean($userInput,$opts);