2013-02-19 49 views
0

我是laravel的新手,但是我發現了一些很奇怪的東西。Laravel v3.2.13-5刀片模板不起作用

在我的刀模板我寫道:

@if($appModule == 'someting') 
    Something 
@elseif($appModule == 'somethingelse') 
    SomethingElse 
@else 
     Nothing 
@endif 

當我跑我得到一個錯誤:

Unhandled Exception

Message:

Error rendering view: [layout]

syntax error, unexpected '?' Location:

...\storage\views/a5d6961979ebea7e1177c3836de35dd8 on line 41

我打開 'a5d6961979ebea7e1177c3836de35dd8',發現這個:

<?php if($appModule == 'someting') Something <?php else: ?>if($appModule == 'somethingelse'): ?> SomethingElse <?php else: ?> Nothing <?php endif; ?> 

回答

0

的「a5d6961979ebea7e1177c3836de35dd8」文件只是您的視圖文件的刀片渲染PHP版本。錯誤本身就在你的視圖文件中。

我注意到您鍵入:

@if($appModule == 'someting') 

不應該說是

@if($appModule == 'something') 
+0

的錯誤在這裏:「<?php if($ appModule =='someting')Something <?php else:?> if」我不明白爲什麼刀片不能正確編譯... – 2013-02-19 20:10:14

+0

是的 - 我注意到那 - 也許它是由你的觀點中其他地方的代碼引起的。如果只有IF語句的觀點,會發生什麼?它是否正確編譯? – Laurence 2013-02-19 20:24:25

+0

我剛剛嘗試過,我注意到如果我只有\ @if \ @endif一切正常,但如果我有\ @if \ @elseif \ @endif它會導致錯誤! – 2013-02-19 20:33:59

0

嘗試轉換(或創建一個新)文件layout.blade.php,下面的格式/編碼:UNIX/ANSI