_canonical_charset

函式
_canonical_charset ( $charset )
Access
Private
引數
  • (string) $charset A charset name.
    Required:
返回值
  • (string) The canonical form of the charset.
相關
  • https://core.trac.wordpress.org/ticket/23688
定義位置
相關方法
rel_canonicalwp_get_canonical_urlwp_specialcharswp_admin_canonical_url_wp_specialchars
引入
3.6.0
棄用
-

canonical_charset: 這個函式用來為當前的HTML文件設定規範的字符集。它不接受任何引數,也不返回任何值。

檢索所提供的字符集的規範形式,適合傳遞給PHP函式,如htmlspecialchars()和charset HTML屬性。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function _canonical_charset( $charset ) {
if ( 'utf-8' === strtolower( $charset ) || 'utf8' === strtolower( $charset ) ) {
return 'UTF-8';
}
if ( 'iso-8859-1' === strtolower( $charset ) || 'iso8859-1' === strtolower( $charset ) ) {
return 'ISO-8859-1';
}
return $charset;
}
function _canonical_charset( $charset ) { if ( 'utf-8' === strtolower( $charset ) || 'utf8' === strtolower( $charset ) ) { return 'UTF-8'; } if ( 'iso-8859-1' === strtolower( $charset ) || 'iso8859-1' === strtolower( $charset ) ) { return 'ISO-8859-1'; } return $charset; }
function _canonical_charset( $charset ) {
	if ( 'utf-8' === strtolower( $charset ) || 'utf8' === strtolower( $charset ) ) {

		return 'UTF-8';
	}

	if ( 'iso-8859-1' === strtolower( $charset ) || 'iso8859-1' === strtolower( $charset ) ) {

		return 'ISO-8859-1';
	}

	return $charset;
}

常見問題

FAQs
檢視更多 >