我有两个相当简单的文件。第一个是这样的 HTML 文件:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<html>
<body>
<form action="test.php" method="post">
Search for: <input type="text" name="search" />
<input type="submit" name="submit" value="Search" />
</form>
</body>
</html>
第二个文件是 test.php,它看起来像这样:
<?
$filepath = "/usr/sbin";
exec("ONE $search -command $filepath ");
fopen($filepath, rw);
?>
我的问题是我想使用 HTML 表单中给出的参数“搜索”作为 PHP 脚本中变量的值。ONE 是我制作的带有一个参数的搜索脚本,我希望它是“$search”。
可以这样做吗?如果可以,怎么做?
提前谢谢了。