导航首页 » 技术教程 » PHP:mb_convert_kana()的用法_mbstring函数
全站头部文字 我要出现在这里
PHP:mb_convert_kana()的用法_mbstring函数 440 2023-12-12   

mb_convert_kana

(PHP 4 >= 4.0.6, PHP 5)

mb_convert_kana — Convert "kana" one from another ("zen-kaku", "han-kaku" and more)

说明

string mb_convert_kana ( string $str [, string $option = "KV" [, string $encoding = mb_internal_encoding() ]] )

Performs a "han-kaku" - "zen-kaku" conversion for string str. This function is only useful for Japanese.

参数

str

The string being converted.

option

The conversion option.

Specify with a combination of following options. Applicable Conversion Options Option Meaning r Convert "zen-kaku" alphabets to "han-kaku" R Convert "han-kaku" alphabets to "zen-kaku" n Convert "zen-kaku" numbers to "han-kaku" N Convert "han-kaku" numbers to "zen-kaku" a Convert "zen-kaku" alphabets and numbers to "han-kaku" A Convert "han-kaku" alphabets and numbers to "zen-kaku" (Characters included in "a", "A" options are U+0021 - U+007E excluding U+0022, U+0027, U+005C, U+007E) s Convert "zen-kaku" space to "han-kaku" (U+3000 -> U+0020) S Convert "han-kaku" space to "zen-kaku" (U+0020 -> U+3000) k Convert "zen-kaku kata-kana" to "han-kaku kata-kana" K Convert "han-kaku kata-kana" to "zen-kaku kata-kana" h Convert "zen-kaku hira-gana" to "han-kaku kata-kana" H Convert "han-kaku kata-kana" to "zen-kaku hira-gana" c Convert "zen-kaku kata-kana" to "zen-kaku hira-gana" C Convert "zen-kaku hira-gana" to "zen-kaku kata-kana" V Collapse voiced sound notation and convert them into a character. Use with "K","H"

encoding

encoding 参数为字符编码。如果省略,则使用内部字符编码。

返回值

The converted string.

范例

Example #1 mb_convert_kana() example

<?php
/* Convert all "kana" to "zen-kaku" "kata-kana" */
$str = mb_convert_kana($str, "KVC");

/* Convert "han-kaku" "kata-kana" to "zen-kaku" "kata-kana" 
   and "zen-kaku" alpha-numeric to "han-kaku" */
$str = mb_convert_kana($str, "KVa");
?>


!!!站长长期在线接!!!

网站、小程序:定制开发/二次开发/仿制开发等

各种疑难杂症解决/定制接口/定制采集等

站长微信:lxwl520520

站长QQ:1737366103