Home > Backend Development > PHP Tutorial > 汉字转换拼音的有关问题

汉字转换拼音的有关问题

WBOY
Release: 2016-06-13 13:24:16
Original
956 people have browsed it

汉字转换拼音的问题
想要把汉字的首字母提出来,网上搜到下面这个函数,不过让人很郁闷的是很多较为不常用的汉字无法识别,例如饽、窦、鹬...等等。不知道该如何解决。

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
function getfirstchar($s0){ 
        $firstchar_ord=ord(strtoupper($s0{0})); 
        if (($firstchar_ord>=65 and $firstchar_ord=48 and $firstchar_ord=-20319 and $asc=-20283 and $asc=-19775 and $asc=-19218 and $asc=-18710 and $asc=-18526 and $asc=-18239 and $asc=-17922 and $asc=-17417 and $asc=-16474 and $asc=-16212 and $asc=-15640 and $asc=-15165 and $asc=-14922 and $asc=-14914 and $asc=-14630 and $asc=-14149 and $asc=-14090 and $asc=-13318 and $asc=-12838 and $asc=-12556 and $asc=-11847 and $asc=-11055 and $asc
Copy after login


------解决方案--------------------
你的这个表太小了,只覆盖3775个汉字。

你可使用这个 http://blog.csdn.net/xuzuning/article/details/5060835
------解决方案--------------------
好深奥~~
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template