运行 php 脚本通过位于其他目录的 html 表单

Running php scripts through html forms located in other directory

我在一个目录下安装了 wamp

E:\folder_name\wamp

它包含所有 www 和 PHP 文件示例 testmysql.php,当我 运行 时它工作正常 直接通过

在浏览器上

http://localhost:80/testmysql.php

我正在处理一个项目并在目录 E:\folder_name\index.html 中创建了一个文件,这个 index.html 的格式是

<form method="post" action="../wamp/www/testmysql.php">

/*
 *  form inputs etc here and submitt button also 
*
*

</form>

当我在浏览器中 运行 它下载 PHP 文件而不是执行它。 对于 PHP 脚本,我正在使用 phpstorm 请帮助我

您 index.html 中的文件夹与您的网络服务器所服务的内容相关,因此它应该是

<form method="post" action="testmysql.php">

如果文件夹结构是这样的

  • E:\folder_name\wamp\www\index.html
  • E:\folder_name\wamp\www\testmysql.php

您必须将地址更改为:

http://localhost/testmysql.php