PHP一个很简单有关问题

WBOY
Release: 2016-06-13 10:11:40
Original
788 people have browsed it

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

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

或者

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

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










------解决方案--------------------
可用ob函数控制
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!