Laravel5.2错误"试图获得非对象的属性"

时间:2016-10-12 07:57:04

标签: php laravel

突然,我的页面出现了两个错误。但我不知道这个错误。救命啊!

1/2

ErrorException in e7e9061cce284d56f8d5e5f1771eed43d8f09c38.php line 198:
Trying to get property of non-object

in e7e9061cce284d56f8d5e5f1771eed43d8f09c38.php line 198
at HandleExceptions->handleError('8', 'Trying to get property of non-object','/home/vagrant/Code/Laravel/storage/framework/views/e7e9061cce284d56f8d5e5f1771eed43d8f09c38.php', '198', array('__path' => '/home/vagrant/Code/Laravel/storage/framework/views/e7e9061cce284d56f8d5e5f1771eed43d8f09c38.php', '__data' => array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'boards' => object(board), 'comments' => object(LengthAwarePaginator), 'replies' => object(Collection)), 'obLevel' => '1', '__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'boards' => object(board), 'comments' => object(LengthAwarePaginator), 'replies' => object(Collection), 'comment' => object(comment), 'reply' => object(comment))) in e7e9061cce284d56f8d5e5f1771eed43d8f09c38.php line 198
at include('/home/vagrant/Code/Laravel/storage/framework/views/e7e9061cce284d56f8d5e5f1771eed43d8f09c38.php') in PhpEngine.php line 42
at PhpEngine->evaluatePath('/home/vagrant/Code/Laravel/storage/framework/views/e7e9061cce284d56f8d5e5f1771eed43d8f09c38.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'boards' => object(board), 'comments' => object(LengthAwarePaginator), 'replies' => object(Collection))) in CompilerEngine.php line 59
at CompilerEngine->get('/home/vagrant/Code/Laravel/resources/views/board/show.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'boards' => object(board), 'comments' => object(LengthAwarePaginator), 'replies' => object(Collection))) in View.php line 149
.... blah

2/2

ErrorException in e7e9061cce284d56f8d5e5f1771eed43d8f09c38.php line 198:
Trying to get property of non-object (View: /home/vagrant/Code/Laravel/resources/views/board/show.blade.php)

in e7e9061cce284d56f8d5e5f1771eed43d8f09c38.php line 198
at CompilerEngine->handleViewException(object(ErrorException), '1') in PhpEngine.php line 44
at PhpEngine->evaluatePath('/home/vagrant/Code/Laravel/storage/framework/views/e7e9061cce284d56f8d5e5f1771eed43d8f09c38.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'boards' => object(board), 'comments' => object(LengthAwarePaginator), 'replies' => object(Collection))) in CompilerEngine.php line 59
at CompilerEngine->get('/home/vagrant/Code/Laravel/resources/views/board/show.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'boards' => object(board), 'comments' => object(LengthAwarePaginator), 'replies' => object(Collection))) in View.php line 149
.... blah

此页面之前已成功加载。我认为我的控制器,视图文件和其他东西中存在一些错字,但我无法找到。

e7e9061cce284d56f8d5e5f1771eed43d8f09c38.php文件的

/ storage / framework / views文件夹 包括第198行

var reply_form = reply_form+'<form action="<?php echo e(route('comment.store')); ?>" method="post">';
            var reply_form = reply_form+'<input type="hidden" name="page_no" value="<?php echo e($boards->id); ?>">';
            var reply_form = reply_form+'<input type="hidden" name="parent_id" value="'+p_article_id+'">';
            var reply_form = reply_form+'<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">';
            var reply_form = reply_form+'<input type="hidden" name="name" value="<?php echo e(Auth::user()->name); ?>">';
            var reply_form = reply_form+'<input type="hidden" name="email" value="<?php echo e(Auth::user()->email); ?>">';// 198 line
            var reply_form = reply_form+'<textarea name="comment" placeholder="내용을 입력해주세요"></textarea>';
            var reply_form = reply_form+'<input type="submit" value="등록">';
            var reply_form = reply_form+'</form>';

1 个答案:

答案 0 :(得分:0)

打开该特定视图文件resources/views/board/show.blade.php,转到line 198。在这里检查您尝试访问的内容确实不存在。