如何在<?php?>内编写html代码,我想在PHP脚本内编写html代码,以便可以从后端回显它. [英] How to write html code inside <?php ?>, I want write html code within the PHP script so that it can be echoed from Backend

查看:36
本文介绍了如何在<?php?>内编写html代码,我想在PHP脚本内编写html代码,以便可以从后端回显它.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在php脚本中创建表..有什么办法可以在php脚本中创建表??

I want to create table inside php script .. Is there any way that i could create table inside php script.?

<?php html code to create table ?>

推荐答案

您可以做到

PHP中的HTML:

<?php
     echo "<table>";
     echo "<tr>";
     echo "<td>Name</td>";
     echo "<td>".$name."</td>";
     echo "</tr>";
     echo "</table>";
?>

或者您也可以这样写.

HTML中的PHP:

<?php /*Do some PHP calculation or something*/ ?>
     <table>
         <tr>
             <td>Name</td>
             <td><?php echo $name;?></td>
         </tr>
     </table>


<?php/*做一些PHP计算或一些事情*/?> 意思是:
您可以使用<?php 打开PHP标签,现在添加您的PHP代码,然后使用?> 关闭标签,然后编写html代码.当需要添加更多PHP时,只需使用<?php 打开另一个PHP标签.


<?php /*Do some PHP calculation or something*/ ?> Means:
You can open a PHP tag with <?php, now add your PHP code, then close the tag with ?> and then write your html code. When needed to add more PHP, just open another PHP tag with <?php.

这篇关于如何在&lt;?php?&gt;内编写html代码,我想在PHP脚本内编写html代码,以便可以从后端回显它.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆