PHP implements Chinese pinyin and example sharing of each Chinese character's initials

Source: Internet
Author: User
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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.