我想通过 PHP 运行它exec
:
./text2speech.sh "My name is Oscar and I am testing the audio."
下面是我的代码。如何在""
不干扰 PHP 的情况下发送?
<?php
function doSomething($command) {
exec("./text2speech.sh". " $command", $output);
echo "Returned output:";
var_dump($output);
}
if(count($_POST) > 0 && isset($_POST['command'])) {
doSomething($_POST['command']);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Terminal Emulator</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input autocomplete="off" id="command" name="command" type="text">
<input type="submit" value="Submit">
</form>
</body>
</html>