Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何解决语法错误、意外'-&燃气轮机';(T_对象_运算符)(0)_Php_Laravel 5.4 - Fatal编程技术网

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)