【发布时间】:2017-07-10 07:47:02
【问题描述】:
我在我的 Raspberry 上创建了一个网络服务器。我可以使用 PHP 执行简单的命令脚本,如下所示:
<?php
if (isset($_POST['on'])) {
exec('sudo /var/www/html/scripts/camOn.sh');
}
?>
<form action="" method="post">
<button type="submit" name="on">On</button>
</form>
我有以下文字转语音脚本
#!/bin/bash
say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet - noconsolecontrols
"http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=$*&tl=En-us"; }
say $*
现在我想在 Html 中创建一个输入文本字段,用于插入我在脚本中编写的文本,而不是“$*”,然后执行它。
我真的不知道该怎么做。 请帮帮我:)
<?php
if (isset($_POST['tts'])) {
exec('sudo /var/www/html/scripts/speech.sh');
}
?>
<form action="" method="post">
Text To Speech:<br>
<input type="text" name="tts"><br>
Send<br>
<input type="submit">
</form>
【问题讨论】:
标签: php shell input webserver raspberry-pi3