English 中文(简体)
php 只偶尔显示代码
原标题:php shows code only sometimes
  • 时间:2012-05-23 02:53:37
  •  标签:
  • php

我在学习PHP(所以我是新手)。我在和阿帕奇的XAMPP(XAMPPP)一起研究个人电脑(窗口7 ) 。

我有两个文件示例格式. html :

<html>
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>

</body>
</html>

并欢迎.php:

<html>
<body>

Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.

</body>
</html>

我创建了这2个文件,并且工作顺利。 星期一我遇到了一个问题, 即点击 buttom 峰顶查询时, 它会给我显示代码而不是结果 。 我搜索了几个论坛, 发现我需要为 httpd. conf (xamppp/pache/ conf/) 添加以下行 :

AddType 应用程序/ x- httpd-php- source.phps

Addype 应用程序/ x- httpd-php.php.php5.php4.php3.phtml.php

Then it worked. Today when I try again it shows me the code once more. Please help. It can t be so complicated!

问题回答

您对 httpd. conf 的更改是否被倒转? 如果是的话, 请尝试将其放回去并重新启动您的缓存 。 否则, 请检查您的 httpd. conf 文件, 请确认 php5 模块已装入, 您应该查找类似此行的行 :

加载模块php5_模块 libexec/pache2/libphp5. so

我不知道 XAMPP, 但似乎每当您重新启动服务器( 即重新启动 Windows) 时, 它都会覆盖配置文件 。

尝试安装 < a href=>" "http://www.wampserver.com/en/" rel="nofollow" >WAMP , 首先是为 Windows 设计的。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签