<?php
function googleTran($text)
{
if (empty($text)) return "";
$wf = file_get_contents('http://fanyi.youdao.com/translate?&doctype=json&type=AUTO&i='.$text);
$info = json_decode($wf,true);
echo '<pre>';
// var_dump($info);
$fanyi = $info["translateResult"];
$return = $fanyi[0][0]["tgt"];
return $return;
}
$test = googleTran('举行“迎国庆”升国旗仪式');
var_dump($test);