刚刚做了一个留言板,为什么当代码是:
<?php
/*
* Created on 2011-11-18
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
include("conn.php");
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?php $sql="SELECT * FROM message";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>
<tr bgcolor="#eff3ff">
<td>标题:<?php=$row[tittle]?> 用户:<?php=$row[user]?> </td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?php=$row[content]?> </td>
</tr>
<?php
}
?>
</table>
显示的结果为
标题:用户:
内容:
标题: 用户:
内容:
标题: 用户:
内容:
标题: 用户:
内容:
标题: 用户:
内容:
如果把里面的<?php都改成<?的时候就变成了:
标题:用户:
内容: (只有两行)
不是说这两个一样吗?还有<?=是什么意思?为什么<?php=的时候就出错了呢?我的message里面的内容为什么没有输出呢?
<?php
/*
* Created on 2011-11-18
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
include("conn.php");
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?php $sql="SELECT * FROM message";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>
<tr bgcolor="#eff3ff">
<td>标题:<?php=$row[tittle]?> 用户:<?php=$row[user]?> </td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?php=$row[content]?> </td>
</tr>
<?php
}
?>
</table>
显示的结果为
标题:用户:
内容:
标题: 用户:
内容:
标题: 用户:
内容:
标题: 用户:
内容:
标题: 用户:
内容:
如果把里面的<?php都改成<?的时候就变成了:
标题:用户:
内容: (只有两行)
不是说这两个一样吗?还有<?=是什么意思?为什么<?php=的时候就出错了呢?我的message里面的内容为什么没有输出呢?
与<?=是等价的,前提是你开启了短标签。
没有见过<?php=这种写法