私はmaster.blade.phpにtop.blade.phpファイルをインクルードしようとしていますが、このエラーが発生します:Laravel @のマスターレイアウトへの組み込み結果:PHP致命的なエラー:134217728バイトのメモリサイズを使い果たしました
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in /Websites/Hermann_Sofa/html/vendor/laravel/framework/src/Illuminate/View/Factory.php on line 534
多分私は何か間違っていますか? ありがとう!
route.php:
Route::get('/', function() {
return view('home');
});
home.blade.php:
<!-- Stored in resources/views/ -->
@extends('layouts.master')
@section('content')
<p>This is my body content.</p>
@stop
top.blade.php:
<!-- Stored in resources/views/ -->
@extends('layouts.master')
@section('top')
<div class="right col-md-4 pull-right">
<span class="phone"><span class="glyphicon glyphicon-earphone"></span> 0743 443.566</span>
<span class="text-right" data-toggle="modal" data-target="#loginModal"><span class="fa fa-shopping-cart"></span>COSUL</span>
</div>
<div class="left col-md-8 hidden-xs">
<span class="label label-warning">PROMOTII</span><span class="promo_1"> Promotii speciale de weekend!</span>
</div>
@endsection
master.blade.php:
<!-- Stored in resources/views/layouts/master.blade.php -->
<html>
<head>
<title>Sofa</title>
</head>
<body>
<div class="top">
<div class="container">
@include('top')
</div>
</div>
<div class="foo">
</div>
</body>
</html>
あなたはどこかでメモリリークがあるようです、それはあなた全体のコードですか?トップビューとホームビューで異なる終了タグを使用しているので、 '@ stop'を' @ endsection'に変更しようとすることができます。 'ini_set( 'memory_limit'、 '256M');をコードのどこかで実行することにより、メモリの上限を一時的に設定することもできます。 –
これは、マスターとトップの間に無限のインクルードループを引き起こしています – feareoc