Laravel @include into master layout results in: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted
Laravel @include into master layout results in: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted
我正在尝试将 master.blade.php 文件包含到 top.blade.php 文件中,但最终出现此错误:
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>
这就是您正在做的事情:top extends master and master include top => cause never-end include => cause Memory error。
解决方案:
删除
@extends('layouts.master')
@section('top')
和
@endsection
来自你的top.blade.php。就是这样
我正在尝试将 master.blade.php 文件包含到 top.blade.php 文件中,但最终出现此错误:
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>
这就是您正在做的事情:top extends master and master include top => cause never-end include => cause Memory error。
解决方案:
删除
@extends('layouts.master')
@section('top')
和
@endsection
来自你的top.blade.php。就是这样