douqiang5163 2014-01-20 23:53
浏览 78
已采纳

使用U + 202E保护文件上传文件

how would one detect if a user put the unicode U+202E in their file? I dont want to accept files with that character for security reasons.

Thank you very much.

  • 写回答

1条回答 默认 最新

  • duanchuang1935 2014-01-21 00:08
    关注

    To remove:

    $str = preg_replace("/[\x{202E}]+/u", "", $str);
    

    or just check if something contains U+202E

    if(preg_match("/[\x{202E}]+/u", $str)){
    

    if you want to search all U+202A-E use [\x{202A}-\x{202E}]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?