php自动补全 <tr>等标签的问题

WBOY
Release: 2016-06-23 14:02:57
Original
1080 people have browsed it

我有一段类似这样的代码

<?php   for($i = 0 ; $i < 10 ; $i++)  {      if($i % 2 == 0)      {        echo "<tr>";      }      echo "<td>@#$%^&*$%^&</td>";      if($i % 2 == 0)      {        echo "</tr>";      }  }?>
Copy after login

我希望创建共5行,每行两列的表格
,可是最终却建立了十行,每行一列

可是当我这样做:
<?php   for($i = 0 ; $i < 10 ; $i++)  {      if($i % 2 == 0)      {        echo "<tr>";      }      echo "<td>@#$%^&*$%^&</td>";  }?>
Copy after login


就正常了,脚本自动生成了tr结束标签

这十分讨厌,当我想创建更复杂的表格的时候,我都闹不清到底哪些标签它会自动生成,哪些不会,到最后生成出来的表格一团乱.

有什么办法让它不自动生成.


回复讨论(解决方案)

最好就是不要用表格控制这些数据,用li之类的多好,不然判断过去判断过来的...

最好就是不要用表格控制这些数据,用li之类的多好,不然判断过去判断过来的...
是我搞错了,逻辑错误而已~~

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!