html nested php:switch

WBOY
Release: 2016-08-08 09:19:35
Original
1781 people have browsed it
<span>转载:http://www.cnblogs.com/glory-jzx/p/3345685.html
If</span> you wan't to use the alternative syntax for switch statements this won't work:

<div>
<?php <span>switch</span>(<span>$variable</span>): ?>
<?php <span>case</span> 1: ?>
<div><span>
Newspage
</span></div>
<?php <span>break</span>;?>
<?php <span>case</span> 2: ?>
</div><span>
Forum
</span><div>
<?php <span>break</span>;?>
<?php <span>endswitch</span>;?>
</div><span>Instead you have to workaround like this</span>:

<div>
<?php <span>switch</span>(<span>$variable</span>): 
<span>case</span> 1: ?>
<div><span>
Newspage
</span></div>
<?php <span>break</span>;?>
<?php <span>case</span> 2: ?>
</div><span>
Forum
</span><div>
<?php <span>break</span>;?>
<?php <span>endswitch</span>;?>
</div>


<p>看了半天原来是PHP 的BUG。。。 唉。。。</p><p> switch : 和 case 之间是不能有任何输出的。。。  PS : 一个空格也不行。。 </p><p><span>you may see the comment in this </span>link ........http://php.net/manual/en/control-structures.alternative-syntax.php</p>
Copy after login

The above introduces the html nested php: switch, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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!