2016-08-10 294 views
-1

我得到這個錯誤: Parse error: syntax error, unexpected '', expecting endswitch (T_ENDSWITCH) or case (T_CASE) or default (T_DEFAULT) in /var/www/mel-suhaib/application/modules/default/views/scripts/user/user.phtml on line 244switch語句語法錯誤

<?php switch ($ext): ?> 

        line244++>  <?php case "pdf": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "docx": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "zip": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "xlsx": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "pptx": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "rar": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "xls": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "jpg": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "ppt": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "doc": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "3gp": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "mp4": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php case "png": ?> 
            <img class="timeline-img pull-left" src="../../assets/admin/pages/media/blog/2.jpg" alt=""> 
            <?php break; ?> 
            <?php endswitch; ?> 
+2

我的眼睛而是從看這都在流血碼。你真的不應該這樣跳出和跳出PHP。 –

+0

使用這種方式 開關($ ext){ } 並且您已經使用了開關($ ext): –

+0

您的'switch()'和第一個'case:' – Bert

回答

0

解決我應該改爲說:

<?php switch ($ext): case "pdf": ?> 

<?php switch ($ext): ?> <?php case "pdf": ?>