首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

mb_substitute_character

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

mb_substitute_character - 设置/获取替换字符

描述

代码语言:javascript
复制
mixed mb_substitute_character ([ mixed $substchar = mb_substitute_character() ] )

当输入字符编码无效或输出字符编码中不存在字符代码时指定替代字符。无效字符可以被替换NULL(无输出),字符串或整数值(Unicode字符码值)。

此设置影响mb_convert_encoding(),mb_convert_variables(),mb_output_handler()和mb_send_mail()。

参数

substchar

将Unicode值指定为整数或以下字符串之一:

  • “none”:没有输出
  • “long”:输出字符代码值(例如:U + 3000JIS + 7E7E
  • “实体”:输出字符实体(例如:?

返回值

如果substchar已设置,则返回TRUE成功,否则返回FALSE。如果substchar未设置,则返回当前设置。

例子

示例#1 mb_substitute_character()示例

代码语言:javascript
复制
<?php
/*?Set?with?Unicode?U+3013?(GETA?MARK)?*/
mb_substitute_character(0x3013);

/*?Set?hex?format?*/
mb_substitute_character("long");

/*?Display?current?setting?*/
echo?mb_substitute_character();
?>

← mb_strwidth

mb_substr_count →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com