In our previous PHP support for rare characters to pinyin and the text of the PHP pinyin to get the first letter of the two articles, we are introduced how to get the first letter of Chinese characters, rare words of the pinyin, then we are going to introduce to you today is how to implement the Chinese pinyin and all Chinese pinyin initials!
The first step is to download the PHP that we need to use in this lesson to implement the Chinese Pinyin class library: http://www.php.cn/xiazai/leiku/740
The second step, after the download, find the PHP class files we need, unzip to our local directory, create a new PHP file!
After the third step, we will call this class in the new PHP file, and instantiate the class:
<?phpinclude_once "codehz.php"; Introduce class file $py = new PinYin (); Instantiate class//output echo "Output kanji all Pinyin:". $py->getallpy ("Anhui Hefei topic.alibabacloud.com"). " <br> "; Shuchuhanzisuoyoupinyinecho "Output Chinese Pinyin:". $py->getfirstpy ("Anhui Hefei topic.alibabacloud.com"); Schzspy?>
Run this file and get the results as shown: