初学PHP,机子安装了php5,apache以及IIS,但是下面这个代码在IIS环境下能正常显示,在apache环境下却不能显示PHP变量值(IIS停了也一样),怎样搞?谢谢
代码:
<body>
<?php
$person=array("姓名","性别","年龄");
?>
<table width="80%" border="0" align="center">
  <tr>
    <td width="33%" bgcolor="#CCFFCC"><div align="center"><?php echo "$person[0]" ?></div></td>
    <td width="33%" bgcolor="#CCFFCC"><div align="center"><?php echo "$person[1]" ?></div></td>
    <td width="33%" bgcolor="#CCFFCC"><div align="center"><?php echo "$person[2]" ?></div></td>
  </tr>
  <tr>
    <td width="33%">张三</td>
    <td>男</td>
    <td>21</td>
  </tr>
  <tr>
    <td width="33%">李四</td>
    <td>男</td>
    <td>15</td>
  </tr>
  <tr>
    <td width="33%">王老</td>
    <td>女</td>
    <td>32</td>
  </tr>
  <tr>
    <td width="33%">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
结果:   
张三 男 21 
李四 男 15 
王老 女 32 

解决方案 »

  1.   

    没问题啊,你的apache或者php配置有问题吧,phpinfo()能页面能显示吗?
      

  2.   

    <body>
    <?php
        <?php
     $HTTP_COOKIE_VARS["Nums"]?($Nums++):($Nums=1);
    setcookie("Nums",$Nums,time()+600);
    echo "这是您第<font color=#ff0000>".$Nums."</font>次访问本页<BR>";
    ?></body>运行上面这段代码结果:
    次访问本页
    "; ?> 这两个页面在IIS环境下都是正常的,但在apache下就这样,可能是它的问题,我又不知道怎么找