PHP显示为纯文本 [英] PHP showing up as plain text

查看:110
本文介绍了PHP显示为纯文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的表单和php文件。当我点击提交时,它只是用resources.php的内容拉出一个纯文本文件。为什么会这样呢?

code>< HTML>
< head>
< / head>
< body>

< form action =resources.phpmethod ='POST'>

< input type =textplaceholder =Namename =name>< br>
< input type =textplaceholder =Organizationname =organization>< br>
< input type =emailplaceholder =E-Mailname =email>< br>
< input type =textplaceholder =Street Addressname =streetaddress>< br>
< input type =textplaceholder =Phone Numbername =phonenumber>< br>
< input type =textplaceholder =什么是三加四? NAME = 人类 ><峰; br>

< input type =submit>

< / form>
< / body>
< / html>

和resources.php文件...

 < HTML> 
< head>< / head>
< body>

<?php

echo'< pre>'。$ _ POST。'< pre>';

?>

< / body>
< / html>

谢谢。

解决方案以下是可能的问题答案:


  1. 由于php未安装,WEB服务器无法正确处理您的PHP代码或配置错误。
  2. 根本没有使用网络服务器。确保从localhost(或任何你的服务器)加载你的页面,而不是从文件本身
    ex:localhost / path / to / index.html
    而不是c://程序文件。 。


I have a simple form and php file. When I click submit it just pulls up a plain text file with the contents of resources.php. Why would this be happening?

index.html

<html>
<head>
</head>
<body>

    <form action="resources.php" method='POST'>

        <input type="text"  placeholder="Name" name="name"><br>
        <input type="text"  placeholder="Organization" name="organization"><br>
        <input type="email" placeholder="E-Mail" name="email"><br>
        <input type="text"  placeholder="Street Address" name="streetaddress"><br>
        <input type="text"  placeholder="Phone Number" name="phonenumber"><br>
        <input type="text"  placeholder="What is three plus four?" name="human"><br>

        <input type="submit">

</form>
</body>
</html>

and the resources.php file...

<html>
<head></head>
<body>

<?php

    echo '<pre>'.$_POST.'<pre>';

?>

</body>
</html>

Thanks.

解决方案

Here are possible answers to your problem:

  1. WEB server is not processing your PHP code correctly because php is not installed or misconfigured.
  2. You're not using the web server at all. Make sure to load your pages from localhost (or whatever your server is) and not from the file itself ex: localhost/path/to/index.html and not c://program files...

这篇关于PHP显示为纯文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆