2
喜使用此代碼文章的網址,並得到結果,但其增加= 0每個結果之前IAMPHP http_build_query錯誤「0 =」
我的代碼
<!DOCTYPE HTML>
<html>
<body>
<h1>In this demonstration:<br />
>tts is done on server side (i.e by using Google-translate server)<br/>
>then the audio received from Google-translate server is saved on your server (local/production)<br />
>and then that saved audio is played through that saved file on this webpage.</h1>
<h3>
Tested with:
Chrome v21 [Working],
Firefox v14 [Not Working, firefox does not support mp3 audio format playback],
IE v9[Working]
</h3>
<hr />
<form method="POST">
Text to convert : <input name="txt" type="text" /><br />
Filename to save (without the extension) : <input name="filename" type="text" /><br />
Convert text to speech : <input name="submit" type="submit" value="Convert" />
</form>
<?php
if (isset($_POST['txt']) && isset($_POST['filename']))
{
$text=htmlentities($_POST['txt']);
$filename=$_POST['filename'].'.mp3';
$querystring = http_build_query(array($text));
if ($soundfile = file_get_contents("http://api.voicerss.org?key=c68635f1104b452e8dbe740c0c0330f3&src=$querystring&hl=en-in j"))
{
file_put_contents($filename,$soundfile);
echo ('
<audio autoplay="autoplay" controls="controls">
<source src="'.$filename.'" type="audio/mp3" />
</audio>
<br />
Saved mp3 location : '.dirname(__FILE__).'\\'.$filename.'
<br />
Saved mp3 uri : <a href="'.$filename.'">'.$_SERVER['SERVER_NAME'].'/webtts/'.$filename.'</a>'
);
}
else echo("<br />Audio could not be saved");
}
?>
它不應該顯示SRC = 0 =好,它應該顯示SRC =好+晚上,如何刪除0 =
由於它的工作原理........... –
@ShiveshJaiswal如果你發現這個答案是有幫助的答案點擊檢查標題接受它並關閉問題。 – Orangepill