<?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('龖龘朱镕基', ' '); echo $result, '</p>'; // echo '<p>转成汉语拼音首字母<br/>'; // $result = $Pinyin->TransformUcwords($words); // echo($result),'</p>';
<?php include 'ChinesePinyin.class.php'; $Pinyin = new ChinesePinyin(); $words = '客戶名稱1'; 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>';
/** * 汉字转拼音 */ function Pinyin($word) { import("@.ORG.Pinyin.ChinesePinyin"); $Pinyin = new ChinesePinyin(); return $Pinyin->TransformUcwords($word); }