mbstring_binary_safe_encoding()
最后更新于:2021-11-27 14:43:41
mbstring_binary_safe_encoding( bool$reset=false)Set the mbstring internal encoding to a binary safe encoding when func_overload is enabled.
参数
- $reset
-
(bool) (Optional) Whether to reset the encoding back to a previously-set encoding.
Default value: false
源文件
文件: gc-includes/functions.php
function mbstring_binary_safe_encoding( $reset = false ) {
static $encodings = array();
static $overloaded = null;
if ( is_null( $overloaded ) ) {
if ( function_exists( 'mb_internal_encoding' )
&& ( (int) ini_get( 'mbstring.func_overload' ) & 2 ) // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
) {
$overloaded = true;
} else {
$overloaded = false;
}
}
if ( false === $overloaded ) {
return;
}
if ( ! $reset ) {
$encoding = mb_internal_encoding();
array_push( $encodings, $encoding );
mb_internal_encoding( 'ISO-8859-1' );
}
if ( $reset && $encodings ) {
$encoding = array_pop( $encodings );
mb_internal_encoding( $encoding );
}
}