PHP汉字转拼音类(UTF-8) 支持带有声调和无声调

<?php

include 'ChinesePinyin.class.php';

$Pinyin = new ChinesePinyin();

$words = '汉字转成拼音类';
echo '<h2>'.$words.'</h2>';



echo '<p>转成带有声调的汉语拼音<br/>';
$result = $Pinyin->TransformWithTone($words);
echo $result,'</p>';



echo '<p>转成带无声调的汉语拼音<br/>';
$result = $Pinyin->TransformWithoutTone($words,' ');
echo($result),'</p>';



echo '<p>转成汉语拼音首字母<br/>';
$result = $Pinyin->TransformUcwords($words);
echo($result),'</p>';

  类文件在网盘中有,搜索"PHP汉字转拼音ChinesePinyin.rar"

posted @ 2019-11-05 08:53  虚幻的街景  阅读(877)  评论(0编辑  收藏  举报