开发者

Cake php newline character

开发者 https://www.devze.com 2023-01-17 11:48 出处:网络
i am using the cakephp paranoid function but i want it to not strip new line character. I tried passing \\n开发者_StackOverflow中文版 in allowed chars but it failedYou have to make sure you using the

i am using the cakephp paranoid function but i want it to not strip new line character. I tried passing \n开发者_StackOverflow中文版 in allowed chars but it failed


You have to make sure you using the correct quotes:

echo Sanitize::paranoid($badString,array("\r\n","\n"));

Always use double quotes if your sending in escape chars, and if your stripping both returns and newlines make sure that "\r\n" comes before, as im sure the function will sanitize int he order of chars passed in.


What syntax are you using? Make sure that $allowedChars is an array and that you used double-quotes for the newline (single-quotes do not parse escapes like newline):

Sanitize::paranoid($badString, array("\n"));
0

精彩评论

暂无评论...
验证码 换一张
取 消