php - Laravel 5 syntax error, unexpected 'extends' (T_EXTENDS) -
this code in controller:
class articlescontroller extends controller { public function index() { $articles = article::all(); return view('articles.index',compact('articles')); } } my app.blade.php
<!doctype html> <html lang="en"> <head> <title>title</title> <meta charset="utf-8"> <meta name=description content=""> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- bootstrap css --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" media="screen"> </head> <body> <div class="container"> @yield('content') </div> @yield('footer') <!-- jquery --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- bootstrap javascript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> </body> </html> and index.blade.php
<?php @extends('app') @section('content') <h1>articles</h1> @stop this error get:
fatalerrorexception in 5f3efcdeb3d9812b22b5491d0cba9f22 line 3: syntax error, unexpected 'extends' (t_extends) please help.
solution listed below. while issue silly, , easy fix - it's hard find straight answer via google search. hence keeping question.
the <?php ?> tags not required in .blade.php files. remove them , works.
(the blade syntax need not in php tags. can however, include php code in tags.)
Comments
Post a Comment