重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
一般来说有两种混合写法,一种是HTML套PHP,写作
;另一种是PHP套HTML,写作
,若php开启短标签写法,也可写作
=$item['RAND']?>
还有一种不太常用的混合写法如下:
easy way to execute conditional html / javascript / css / other language code with php if else:
html code to run if condition is true
html code to run if condition is false
列出项目中的一段代码的两种写法:
if($resitem['PREVIEW']){
echo $resitem['PREVIEW'];
} else {
echo "static/images/bg72.png";
}
?>
写法二:
if($resitem['PREVIEW']): ?> =$resitem['PREVIEW']?>static/images/bg72.png
总结完毕;感谢大家的阅读,希望大家有所收益。
更多可以参考官方文档http://www.php.net/manual/zh/control-structures.if.php
本文转自:https://blog.csdn.net/freshlover/article/details/9279527
推荐教程:《php教程》
本文名称:详细解说三种PHP嵌套HTML的写法
当前地址:http://cqcxhl.com/article/cjejcs.html