<?php include_once 'Pinyin.php'; echo Pinyin::getPinyin("早上好"); echo Pinyin::getShortPinyin("早上好");
function qa_q_request($questionid, $title) { $title = Pinyin::getPinyin($title); return qa_q_request_base($questionid, $title); }
<?php /** * Created by PhpStorm. * User: jifei * Date: 15/6/25 */ include_once 'Pinyin.php'; echo Pinyin::getPinyin("ну╔¤║├", 'gb2312'); echo Pinyin::getShortPinyin("ну╔¤║├", 'gb2312');
<?php /** * 拼音转换类测试程序 */ require_once dirname(__FILE__) . "/Pinyin.php"; // 确定换行符 $s_br = php_sapi_name() == "cli" ? "\n" : "<br>"; // 测试汉字转拼音 $keyword = "黄老师1232很dsdf犀利,number1"; $str = Pinyin::getPinyin($keyword); echo $str . $s_br; // 测试获取汉字首字母 $keyword = "好联系"; $str = Pinyin::getPinyin($keyword, 1); echo $str . $s_br;