gcdb::check_ascii()

最后更新于:2021-11-26 07:54:27

gcdb::check_ascii( string$string)

Checks if a string is ASCII.

参数

$string

(string) (Required) String to check.

响应

(bool) True if ASCII, false if not.

源文件

文件: gc-includes/gc-db.php

	protected function check_ascii( $string ) {
		if ( function_exists( 'mb_check_encoding' ) ) {
			if ( mb_check_encoding( $string, 'ASCII' ) ) {
				return true;
			}
		} elseif ( ! preg_match( '/[^x00-x7F]/', $string ) ) {
			return true;
		}

		return false;
	}