这样写if else语句也能有错?

WBOY
Release: 2016-06-23 14:00:26
Original
826 people have browsed it

我本来打算将这一段代码嵌入到php脚本当中,但是老是提示一个错误:
Parse error: syntax error, unexpected T_ELSE in C:\AppServ\www\demo\templates_c\1d7c7a527b6335cc7a623305ca940e1findex.tpl.php on line 14

<?php if ($status) {?><div>This is the first block.<br /></div><?php } ?><?php else {?><div>This is the third block.<br /></div><?php } ?>
Copy after login


下图实在zend studio里面的错误提示


希望高手能帮帮忙,就小弟于水火之中啊!!!谢谢啦!!!!!


回复讨论(解决方案)

光是你给的这段没啥问题 是不是你外面还有大括号啊

 感觉没什么问题,你这个$status是怎么获取的

这样写应该就不提示错误了

光是你给的这段没啥问题 是不是你外面还有大括号啊
谢谢你!问题已经解决了,我这个是在循环打印的时候,一定要像三楼那样写,不能讲右花括号与else语句分开,并且和elseif一样,如果有的话,也不能分开!

 感觉没什么问题,你这个$status是怎么获取的
谢谢你!其实就应该像三楼那样写!

这样写应该就不提示错误了
三楼正解!!!!

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!