php Symfony\Component\Debug\Exception\FatalErrorException 语法错误,文件意外结束(Laravel)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21492956/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Symfony \ Component \ Debug \ Exception \ FatalErrorException syntax error, unexpected end of file (Laravel)
提问by Luillyfe
The master.blade.php's file contains:
master.blade.php 的文件包含:
@section('content')
@foreach($admons as $admon)
<p>{{ $admons->admon }}</p>
@foreach
@stop
and it is throwing me the error:
它向我抛出错误:
Symfony \ Component \ Debug \ Exception \ FatalErrorException
syntax error, unexpected end of file
C:\AppServ\www\Viniza\app\storage\views\b48f03c3d0a952af7b5dd24750898f94
C:\AppServ\www\Viniza\app\storage\views\b48f03c3d0a952af7b5dd24750898f94
$(document).ready(function() {
$('ul.sf-menu').sooperfish();
$('.top').click(function() {$('html, body').animate({scrollTop:0}, 'fast'); return false;});
});
</script>
</body>
</html>
the full content of master.blade.php's file is:
master.blade.php 文件的全部内容是:
{{ HTML::style('css/style.css') }}
{{ HTML::script('js/jquery.js') }}
@section('content')
@foreach($admons as $admon)
<p>{{ $admons->admon }}</p>
@foreach
@stop
<!DOCTYPE HTML>
<html>
<head>
<title>Viniza Konw</title>
<meta name="keywords" content="coffee buy shop" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<div id="main">
<header>
<div id="logo">
<div id="logo_text">
<h1><a href="index.html">Coffe<span class="logo_colour">JuanValdez</span></a></h1>
</div>
</div>
<nav>
<div id="menu_container">
<ul class="sf-menu" id="nav">
<li><a href="#">Home</a></li>
</ul>
</div>
</nav>
</header>
<div id="site_content">
<div class="content">
<h1></h1>
<div class="header_image">
{{ HTML::image('images/header_image.jpg', "Imagen no encontrada",
array('id' => 'center', 'title' => 'center')) }}
</div>
<div class="border_top"></div>
<div class="border_bottom"></div>
</div>
</div>
<div id="scroll">
<a title="Scroll to the top" class="top" href="#"><img src="images/top.png" alt="top" /></a>
</div>
<footer>
<p><img src="images/twitter.png" alt="twitter" />
<img src="images/facebook.png" alt="facebook" />
<img src="images/rss.png" alt="rss" /> </p>
<p>Copyright © CSS3_winter_scene | <a href="http://www.css3templates.co.uk">design from css3templates.co.uk</a></p>
</footer>
</div>
<!-- javascript at the bottom for fast page loading -->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.easing-sooper.js"></script>
<script type="text/javascript" src="js/jquery.sooperfish.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('ul.sf-menu').sooperfish();
$('.top').click(function() {$('html, body').animate({scrollTop:0}, 'fast'); return false;});
});
</script>
</body>
</html>
回答by Patrick
This error in Symphony is usually telling you that you didn't 'end' a control structure (i.e. an 'if' or 'foreach').
Symphony 中的这个错误通常告诉您没有“结束”控制结构(即“if”或“foreach”)。
You have a couple typos, where you are ending your foreach with "@foreach" it should be "@endforeach".
你有几个错别字,你用“@foreach”结束你的foreach,它应该是“@endforeach”。
That should do it for you.
那应该为你做。
回答by Yogesh Mistry
In my case, it was the silliest mistake. I missed out a ;while creating a route with a closure function.
就我而言,这是最愚蠢的错误。我错过了;创建带有闭包函数的路由的时间。
So, if you've not made any mistakes as pointed out by above 2 answers, look for any syntax error in your routes\web.php(Laravel 5.3+)
因此,如果您没有犯以上 2 个答案所指出的任何错误,请在您的routes\web.php(Laravel 5.3+) 中查找任何语法错误
回答by Fab
I just ran into the same error and it was due to a GIT conflict. So if the first answer doesn't fix the problem, look for "<<< HEAD" in your code
我刚刚遇到了同样的错误,这是由于 GIT 冲突造成的。因此,如果第一个答案不能解决问题,请在代码中查找“<<< HEAD”

