您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP汉字转拼音代码分析

2024/12/8 9:03:00发布14次查看
首先需要前台模版index.html
汉子转拼音带音标_php博客 首 页 文章列表
教程:汉子转拼音代码分析 内容:
拼 class=btn id=pinyin/>
powered by sucaihuo.com 本站皆为作者原创,转载请注明原文链接:liqingbo.cn

当我们输入所要转换的汉字后,将数据提交到pinyin.php文件进行转换,在返回到index.html文件中
完整代码:
public function pinyin(){ if(is_post){ header(content-type:text/html;charset=utf-8); include(application.common/chinesepinyin.class.php); $pinyin = new chinesepinyin(); $str = $_post['str']; if(strlen($str)transformwithtone($str); $pinyin2 = $pinyin->transformwithouttone($str); $pinyin3 = $pinyin->transformucwordsonlychar($str); $pinyin4 = $pinyin->transformucwords($str); echo '带声调的汉语拼音: '.$pinyin1.''; echo '
'; echo '无声调的汉语拼音: '.$pinyin2.''; echo '
'; echo '首字母只包括汉字: '.$pinyin3.''; echo '
'; echo '首字母和其他字符: '.$pinyin4.''; echo '
'; exit; } $this->display('pinyin'); }
以上例子为thinkphp框架下的
实例效果:汉子转拼音带音标
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product