<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
  <?php
      $sql="select *from message ";
      $result=mysql_query($sql);
     while($row=mysql_fetch_array($result)){
   ?>  <tr bgcolor="#eff3ff">
  <td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td>
  </tr>  <tr bgColor="#ffffff">
  <td>内容:<?=$row[content]?></td>
  </tr>
  <?}?>
</table>我这个文件是保存为PHP 的
为什么    有的地方必须用<?.....?>而有的地方必须用<?PHP......?>呢?????改了就无法解释了

解决方案 »

  1.   

    php.ini中开启了短标记  short_open_tag 
      

  2.   

    建议一直使用<?php ?>,因为这个是标准的标记
      

  3.   

    short_open_tag =on
    这样就可以在所有的地方都用 <?。。?>了
      

  4.   


    可是我 关闭了短标签  怎么在HTML中 不能使用<?PHP?>
      

  5.   

    <?    php?>
    没有这样的写法: 只有<?  ?>,<?php  ?>  php跟在前面的问号
      

  6.   

    我想描述的就是<?php     ?>
      

  7.   

    你的代码中有三种
    <?php ?>
    <? ?>
    <?= ?>
    其中前两种效果一致,但推荐使用第一种
    第三种为第二种的扩展用法,其执行结果等于<?php echo ; ?>
    即<?=$var?>的效果和<?php echo $var; ?>相同
    后两种均需要short_open_tag支持,但并不推荐使用,在新版本的php中即将废弃