首頁  >  文章  >  後端開發  >  html嵌套php:switch

html嵌套php:switch

WBOY
WBOY原創
2016-08-08 09:19:351783瀏覽
<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>

以上就介紹了html巢狀php:switch,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn