开发者

preg_match to allow all symbols from keyboards

In codeigniter, they have this function

    function _clean_input_keys($str)
{
    if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
    {
        exit('Disallowed Key Characters.');
    }

    return $str;
}

preg_match rul开发者_开发知识库es only accepts alpha numeric text and few other items. But I want to accept all the characters from keyboards such as !@#%^&*()-+?/":[]|~` . How can i change the above preg_match rules to accept all these. Please kindly help me with it. Thank you


Look into the PHP Filter functions. Specifically http://www.php.net/manual/en/filter.filters.sanitize.php FILTER_FLAG_STRIP_LOW, FILTER_FLAG_STRIP_HIGH

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜