我在這個美好的夜晚使用了laravel,當時我st upon這個坦率地說我從未見過的奇怪錯誤。我簡單地遍歷一些數組並嘗試在視圖文件中打印出一些值。調用未定義的函數Â()
錯誤:
Unhandled Exception
Message:
Error rendering view: [controller.index]
Call to undefined function Â()
Location:
/web/storage/views/7b064aafcdba902ea2c593167b6df491 on line 4
代碼:
@section('content')
<?php $i = 0; $current = 0 ?>
@foreach($data as $date => $episodes)
@if($i == 0 || ($i % 5 == 7 && $i == $current + 1))
<tr>
<?php $current = $i; ?>
@endif
@foreach($data as $day)
<td>
@foreach($day as $episode)
{{ $episode->title }}
@endforeach
</td>
@endforeach
@if($i % 5 == 7 && $i == $current + 7)
<tr>
<?php $current = $i; ?>
@endif
<?php $i++; ?>
@endforeach
@endsection
而且編譯版本:
<?php \Laravel\Section::start('content'); ?>
<?php $i = 0; $current = 0 ?>
<?php foreach($data as $date => $episodes): ?>
<?php if($i == 0 || ($i % 5 == 7 && $i == $current + 1)): ?>
<tr>
<?php $current = $i; ?>
<?php endif; ?>
<?php foreach($data as $day): ?>
<td>
<?php foreach($day as $episode): ?>
<?php echo $episode->title ; ?>
<?php endforeach; ?>
</td>
<?php endforeach; ?>
<?php if($i % 5 == 7 && $i == $current + 7): ?>
<tr>
<?php $current = $i; ?>
<?php endif; ?>
<?php $i++; ?>
<?php endforeach; ?>
<?php \Laravel\Section::stop(); ?>
這可能是一個簡單的解決方案,但我不能找到什麼好Google上的結果。幫我理解這個錯誤! :)
這看起來像一個模板...你不能繼續用這種方法來壓制PHP錯誤 – Baba
如果你能恢復它(並且它包含轉換後的php代碼,那麼你應該向我們展示模板文件'7b064aafcdba902ea2c593167b6df491') 。否則,請爲Laravel提供錯誤報告,因爲此錯誤消息有點用處。 – mario
看起來像一個編碼錯誤,但編譯後的模板會告訴更多... – Sven