0
我想將用戶在簡單的HTML表單中提交的字符串(如下所示)傳遞給shell腳本。
到目前爲止我還沒有找到答案。我會很感激任何提示。通過CGI將字符串傳遞到shell腳本
<form method="post" action="http://example.com/cgi-bin/echo.sh">
<input type="text" name="Text" value=""><br>
<input type="submit" value="Submit">
</form>
而一個shell腳本應該打印它捕獲的值。
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo '<html>'
echo '<head>'
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
echo '<title>Echoing argument</title>'
echo '</head>'
echo '<body>'
echo $1
echo '</body>'
echo '</html>'
'echo「$ QUERY_STRING」''而不是'set $ QUERY_STRING; echo $ 1' –
@thatotherguy,謝謝!好多了! – fieryvova