©
本文档使用
php.cn手册 发布
(PHP 4 >= 4.0.5, PHP 5, PHP 7)
iconv_set_encoding — 为字符编码转换设定当前设置
$type
, string $charset
)
将 type
设置的值从内部配置变量更改为 charset
。
type
type
的值可以是以下其中任意一个:
charset
字符集。
成功时返回 TRUE
, 或者在失败时返回 FALSE
。
Example #1 iconv_set_encoding() 例子
<?php
iconv_set_encoding ( "internal_encoding" , "UTF-8" );
iconv_set_encoding ( "output_encoding" , "ISO-8859-1" );
?>
[#1] joe dot bowman at edigitalresearch.com [2014-11-18 10:26:52]
As of PHP 5.6, this throws a Deprecated level error, as is consistent with setting the iconv.*_encoding ini settings:
iconv_set_encoding('internal_encoding', 'UTF-8');
triggers:
PHP Deprecated: iconv_set_encoding(): Use of iconv.internal_encoding is deprecated in ...
[#2] pasamio at gmail dot com [2008-01-03 23:18:00]
On PHP 5.2.5 when iconv.*_encoding values are set using php_admin_value in the Apache configuration file, this call will fail and return false.