选择语言 :

 Core_Valid::alpha_numeric

Checks whether a string consists of alphabetical characters and numbers only.

boolean Core_Valid::alpha_numeric( string $str [, boolean $utf8 = bool false ] )

参数列表

参数 类型 描述 默认值
$str string Input string
$utf8 boolean Trigger UTF-8 compatibility bool false
返回值
  • boolean
File: ./core/classes/valid.class.php
public static function alpha_numeric($str, $utf8 = false)
{
    if ($utf8 === true)
    {
        return (bool)preg_match('/^[\pL\pN]++$/uD', $str);
    }
    else
    {
        return ctype_alnum($str);
    }
}