Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP表中添加换行符_Php_Line Breaks - Fatal编程技术网

在PHP表中添加换行符

在PHP表中添加换行符,php,line-breaks,Php,Line Breaks,不知是否有人能帮助我 我正在使用下面的代码在我的网页上创建一个表 <table id="report" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="150"></th> <th width="140"><div align="left">Location

不知是否有人能帮助我

我正在使用下面的代码在我的网页上创建一个表

   <table id="report" width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
              <th width="150"></th>
          <th width="140"><div align="left">Location Name</div></th>
          <th width="398"><div align="left">Address</div></th>
              <th width="124"><div align="center">Finds Made</div></th>
              <th width="280"></th>
              <th width="101"></th>
              <th width="166"></th>
              <th width="90"></th>
        </tr>
        <?php

                        echo "<tr>
                                <td><div><a href='delete.php?locid=$lid'>Delete Location</a></div></td> 
                                <td><div align='left'>$lname</div></td>
                                <td><div align='left'>$laddress</div></td>
                                <td><div align='center'>$findscount</div></td>
                                <td><div><a href='viewlocation.php?locid=$lid'>View/Amend Location Details</a></div></td>  
                                <td><div><a href='addfinds.php?locid=$lid'>Add Finds</a></div></td> 
                                <td><div><a href='addfinds.php?locid=$lid'>Add Find Images</a></div></td>
                                <td><div><a href='finddetails.php?locid=$lid'>View Finds</a></div></td> 
                            </tr>";
                            echo "<th colspan=\"8\"><hr width=\"100%\"></th>";

地点名称
地址
发现
您的
还需要包装
。然后将其添加到css中

th[colspan=8] { margin-top: 1em; }

我通常是这样做的:

echo "<th colspan=\"8\"><hr width=\"100%\"></th>\r\n" .
     "<td></td>" .
echo“
\r\n”。 "" .
…等等。



<tr><th colspan="8"><br/><hr width="100%"></th><tr>

您可以尝试回显“$nbsp;”;您好@ZuberSurya,感谢您抽出时间回复我的帖子。我已经尝试了代码,但不幸的是它不起作用,我收到了一个常量“ENCAPSED”字符串错误。非常感谢你。Kind regardsI通常从不回显或打印html标记。我总是关闭PHP脚本标记
?>
,然后在html之后重新打开它。然后可以输出值,如
。如果这是一个更复杂的项目,请使用Smarty这样的模板引擎。嗨@Jan Petzold,谢谢你花时间回复我的帖子。我已经将cod添加到我的帖子中,虽然我没有收到任何错误,但是没有创建换行符。我认为也可以通过css、填充顶部(替换
)和边框底部(替换
)、高度和显示块来实现