/**
* GOOGLE翻译 英汉
*
* @param string $text 翻译句
* @return unknown
*/
function googleTran($text){
if(empty($text)) return "";
sleep(1);//反间碟
$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;
}
//截取相关信息
$return = "";
$wf=strip_tags($wf,"
");
$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.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/320135.htmlTechArticle代码分享给大家 复制代码 代码如下: ? /** * GOOGLE翻译 英汉 * * @param string $text 翻译句 * @return unknown */ function googleTran($text){ if(empty($text)) retu...