Php 如何解决语法错误、意外'-&燃气轮机';(T_对象_运算符)(0)
获取以下错误Php 如何解决语法错误、意外'-&燃气轮机';(T_对象_运算符)(0),php,laravel-5.4,Php,Laravel 5.4,获取以下错误 class CreatesController extends Controller { public function home() { $articles =Article::all(); return view('home',['article'=>$articles]); } } 替换 syntax error, unexpected '->' (T_OBJECT_OPERATOR) (View: C:\
class CreatesController extends Controller
{
public function home()
{
$articles =Article::all();
return view('home',['article'=>$articles]);
}
}
替换
syntax error, unexpected '->' (T_OBJECT_OPERATOR) (View: C:\xampp\htdocs\laravelcrud\resources\views\home.blade.php)
与
使用以下语法返回到视图
returnview('home',compact('articles')代码>
并将以下内容用于foreach
@foreach($articles作为$article)
//你的代码在这里
@endforeach
syntax error, unexpected '->' (T_OBJECT_OPERATOR) (View: C:\xampp\htdocs\laravelcrud\resources\views\home.blade.php)
@foreach(@articles->all() as $article)
@foreach($articles as $article)