PHP 联系表
我的联系表单工作正常,但当您按提交时,它会下载 PHP 文件。
<form name="contactform" method="post" action="send_form_email.php">
这是提交按钮:
<input type="submit" name="button" class="button" value="Send">
如果这应该发生在离线模式下,那么好吧。
My Contact form works fine but when you press submit, it downloads the PHP File.
<form name="contactform" method="post" action="send_form_email.php">
And this is the submit button:
<input type="submit" name="button" class="button" value="Send">
If this is supposed to happened in offline mode then okay.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
出现“离线模式”是因为 Web 浏览器直接读取 PHP。您必须将 PHP 文件放入 localhost 或 Web 主机中。
The "offline mode" is occurring because the PHP is being read directly by the web browser. You must put your PHP files in either a localhost or web host.
如果离线模式只是意味着您直接从文件系统在浏览器中打开了脚本,那么这是预期的行为,因为 PHP 没有通过其解析器运行。
您需要设置一个 Web 服务器来提供
.php
脚本。另一方面,如果这是由网络服务器提供服务,那么它们的配置就有问题。
If by offline mode you simply mean you have opened the script in your browser directly from the file system then that is the expected behaviour as the PHP is not being run through it's parser.
You need a web server set up to serve
.php
scripts.On the other hand, if this is being served by a web server then their is a problem with its configuration.
这种情况永远不应该发生,你的 php 文件永远不应该下载到客户端计算机上。
想象一下您的网络服务器上有一个包含密码和其他内容的配置文件。
您应该检查您是否已安装 php 并且 apache 设置是否正确。
This should never happen, you php file should never be downloaded to clients computer.
Just imagine a config file on your web server with the passwords and stuff.
You should check that you have php installed and that apache settings are correct.
PHP 未通过 PHP 解析器运行 - 或者与标头一起发送以强制下载。与托管提供商联系。
The PHP is not being run through the PHP parser - or is being sent with headers to force download. Speak to the hosting provider.
“离线模式”是什么意思?
本质上,这里发生的情况是 HTTP POST 中联系的 Web 服务器未配置为处理 PHP 代码。所以默认情况下它只是返回请求的文件。您需要配置 Web 服务器来相应地处理 PHP 代码,并且此过程因 Web 服务器而异(但通常包括 在服务器上安装 PHP)。
还应该注意的是,如果不正确配置服务器,您可能会面临巨大的安全风险。如果人们可以直接下载 PHP 文件,那么他们就可以看到服务器应该处理的代码。一旦您将其配置为处理该代码,他们就会拥有该代码的副本并可以利用它。更简单的是,如果代码包含任何敏感信息(例如针对数据库进行身份验证的凭据),那么您就会将该信息公开给全世界。
What do you mean by "offline mode"?
Essentially what's happening here is that the web server being contacted in the HTTP POST isn't configured to process the PHP code. So it's just returning the requested file by default. You'll need to configure the web server to handle the PHP code accordingly, and this process varies between web servers (but generally includes installing PHP on the server).
It should also be noted that by not configuring the server properly you may be exposing a huge security risk. If people can download the PHP files directly then they can see the code that the server is supposed to be processing. Once you configure it to process that code, they'll have a copy of it and can exploit it. Even simpler, if the code contains any sensitive information (such as credentials to authenticate against a database) then you'd be exposing that information to the world.