目前最漂亮的解法:
http://www.konradkiss.com/2012/01/embedding-text-to-speech-into-html5.html?showComment=1334763465926#c1777103489873048698
HTML
PHP
"utf-8","tl" => $_GET["tl"], "q" => $_GET["q"]));
$ctx = stream_context_create(array("http"=>array("method"=>"GET","header"=>"Referer: \r\n")));
$soundfile = file_get_contents("http://translate.google.com/translate_tts?".$qs, false, $ctx);
header("Content-type: audio/mpeg");
header("Content-Transfer-Encoding: binary");
header('Pragma: no-cache');
header('Expires: 0');
echo($soundfile);
?>
http://www.konradkiss.com/2012/01/embedding-text-to-speech-into-html5.html?showComment=1334763465926#c1777103489873048698
HTML
PHP
"utf-8","tl" => $_GET["tl"], "q" => $_GET["q"]));
$ctx = stream_context_create(array("http"=>array("method"=>"GET","header"=>"Referer: \r\n")));
$soundfile = file_get_contents("http://translate.google.com/translate_tts?".$qs, false, $ctx);
header("Content-type: audio/mpeg");
header("Content-Transfer-Encoding: binary");
header('Pragma: no-cache');
header('Expires: 0');
echo($soundfile);
?>
留言
張貼留言