选择语言 :

 Core_Valid::alpha

Checks whether a string consists of alphabetical characters only.

boolean Core_Valid::alpha( 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($str, $utf8 = false)
{
    $str = (string)$str;

    if ($utf8 === true)
    {
        return (bool)preg_match('/^\pL++$/uD', $str);
    }
    else
    {
        return ctype_alpha($str);
    }
}