Removing control characters from a UTF-8 string in PHP

后端 未结 1 1830
轻奢々
轻奢々 2020-12-30 01:19

So I am removing control characters (tab, cr, lf, \\v and all other invisible chars) in the client side (after input) but since the client cannot be trusted, I have to remov

相关标签:
1条回答
  • 2020-12-30 02:06

    it seems that I just need to add the u flag to the regex thus it becomes:

    $s = preg_replace('/[\x00-\x1F\x7F-\x9F]/u', '', $s);
    
    0 讨论(0)
提交回复
热议问题