Home >Backend Development >PHP Tutorial > PHP一个很简单有关问题

PHP一个很简单有关问题

WBOY
WBOYOriginal
2016-06-13 13:45:30800browse

PHP一个很简单问题
判断一个变量,如果变量为空则不执行,比如if($a)之类,但我说的不执行是指不执行html,就是说if($a)(为假){html不显示
}不知道怎么样写,照着上面写法,会出现错误

------解决方案--------------------
exit() ?
------解决方案--------------------
if(!empty($a)){
?>
html---html-----
}
?>

或者

echo !empty($a)?'$a真时出现':'反之';
?>
------解决方案--------------------
if($a){
?> 
显示html代码................

------解决方案--------------------










------解决方案--------------------
可用ob函数控制
Statement:
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