DEDECMS文件保存目录直接转英文的方法

DEDECMS文件保存目录直接转英文的方法,第1张

DEDECMS文件保存目录直接转英文的方法 织梦DEDECMS文件保存目录直接转英文的方法

有的朋友喜欢把dedecms文件保存目录直接用英文,那么可以通过以下方法。 修改文件:dede/templets/catalog_add.htm   function CheckTypeDir() 在这个函数下方增加   function Checkgoogle(){ var google = document.getElementById('google'); var tpobj = document.getElementById('typedir'); var upinyin = document.getElementById('pinyin'); if(google.checked) tpobj.style.display = "none"; else tpobj.style.display = "block"; if(google.checked) upinyin.style.display = "none"; else upinyin.style.display = "block"; } 搜索   替换为   拼音 英文 dede/catalog_add.php 搜索   //用拼音命名 在其下方增加   //用谷歌翻译英文 if($google==1 || $typedir=='') { $typedir = googleTran(stripslashes($typename)); } /include/extend.func.php 最末尾增加   function googleTran($text){ if(empty($text)) return ""; $wf=@file_get_contents('http://translate.google.cn/translate_t?sl=zh-CN&tl=en&text='.$text.'#'); if (false===$wf||empty($wf)) { return false; } $return = ""; $star="style.backgroundColor='#fff'">"; $end="   "; $p = "#{$star}(.*){$end}#iU";//i表示忽略大小写,U禁止贪婪匹配 if(preg_match_all($p,$wf,$rs)) { return $rs[1][0]; } }

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/3007189.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-09-27
下一篇 2022-09-27

发表评论

登录后才能评论

评论列表(0条)

保存