/**
* GOOGLE Translation English-Chinese
*
* @param string $text translation sentence
* @return unknown
*/
function googleTran($text){
if(empty($text)) return "";
sleep(1);//return
$wf=@file_get_contents('http:/ /translate.google.cn/translate_t?sl=en&tl=zh-CN&text='.urlencode($text).'#');
if (false===$wf||empty($wf)){
return false; 🎜> $star=strpos($wf,"
");
if(false===$star){
return false;
}
$end=strpos($wf,"
");
if(false===$end){
return false;
}
$return = strip_tags(substr($wf,$star,$end-$star));
return iconv("GB2312","UTF-8",trim($return));
}
?>
http://www.bkjia.com/PHPjc/320135.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/320135.htmlTechArticleThe code is shared with everyone. Copy the code as follows: ? /*** GOOGLE Translate English-Chinese * * @param string $text translation sentence * @return unknown*/ function googleTran($text) { if(empty($text)) retu...