如何在一个文件中编写php html更漂亮?
发布时间:2020-12-13 13:24:09 所属栏目:PHP教程 来源:网络整理
导读:?if($id == 2) {? html goes here?} else { ? if id is not 2 then something goes here?}? 如何在没有学习聪明的情况下在一个更漂亮的文件中编写php html? 你可以使用 PHP’s alternative syntax for control structures: ? if ($id == 2): ? h2some html
<? if($id == 2) { ?> html goes here <? } else { ?> if id is not 2 then something goes here <? } ?> 如何在没有学习聪明的情况下在一个更漂亮的文件中编写php html?
你可以使用
PHP’s alternative syntax for control structures:
<? if ($id == 2): ?> <h2>some html</h2> <? else: ?> <h2>another html chunk</h2> <? endif ?> 请注意,short_open_tags是一个需要显式启用的php.ini指令,否则每次都必须写<?php. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |