使用未定义的常量布局-假定为“布局”(这将在以后的PHP版本中引发错误)

时间:2019-06-13 15:59:09

标签: laravel eloquent laravel-5.8

您好,我正在尝试创建一个名为<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <h2>sortdata</h2> <input id="searchInput" type="text" value="" placeholder="search"/> <select name="studyselector" id="studyselector"> <option value="All">All news</option> <option value="Cat1">Category 1</option> <option value="Cat2">Category 2</option> <option value="Cat3">Category 3</option> <option value="Cat4">Category 4</option> <option value="Cat5">Category 5</option> <option value="Cat6">Category 6</option> <option value="Cat7">Category 7</option> </select> <hr /> <div id="searchFilterDiv"> <div class="CompanyDirectoryItem search-results-box-item" data-name=" All, Cat1"> <div class="thumb"> <img alt="Our ALT text here" title="Our title here" src="http://placehold.it/150x150"> </div> <div class="news-txt"> <h3><a href="">A news title1</a></h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p> </div> </div> <div class="CompanyDirectoryItem search-results-box-item" data-name="All, Cat2, Cat5"> <div class="thumb"> <img alt="Our ALT text here" title="Our title here" src="http://placehold.it/150x150"> </div> <div class="news-txt"> <h3><a href="">A news title2</a></h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p> </div> </div> <div class="CompanyDirectoryItem search-results-box-item" data-name="All, Cat3"> <div class="thumb"> <img alt="Our ALT text here" title="Our title here" src="http://placehold.it/150x150"> </div> <div class="news-txt"> <h3><a href="">A news title3</a></h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p> </div> </div> <div class="CompanyDirectoryItem search-results-box-item" data-name="All, Cat4"> <div class="thumb"> <img alt="Our ALT text here" title="Our title here" src="http://placehold.it/150x150"> </div> <div class="news-txt"> <h3><a href="">A news title4</a></h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p> </div> </div> <div class="CompanyDirectoryItem search-results-box-item" data-name="All, Cat5"> <div class="thumb"> <img alt="Our ALT text here" title="Our title here" src="http://placehold.it/150x150"> </div> <div class="news-txt"> <h3><a href="">A news title5</a></h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p> </div> </div> <div class="CompanyDirectoryItem search-results-box-item" data-name="All, Cat6, Cat1"> <div class="thumb"> <img alt="Our ALT text here" title="Our title here" src="http://placehold.it/150x150"> </div> <div class="news-txt"> <h3><a href="">A news title6</a></h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p> </div> </div> <div class="CompanyDirectoryItem search-results-box-item" data-name="All, Cat7, Cat3"> <div class="thumb"> <img alt="Our ALT text here" title="Our title here" src="http://placehold.it/150x150"> </div> <div class="news-txt"> <h3><a href="">A news title7+3</a></h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p> </div> </div> <div class="CompanyDirectoryItem search-results-box-item" data-name="All, Cat7"> <div class="thumb"> <img alt="Our ALT text here" title="Our title here" src="http://placehold.it/150x150"> </div> <div class="news-txt"> <h3><a href="">A news title7</a></h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p> </div> </div> </div>的新视图,但显示错误:

  

使用未定义的常量布局-假定为“布局”(这将引发   PHP的未来版本中出现错误)

视图结构:

enter image description here

控制器:

showrecord

路线:

public function index()
{
    return view('showrecord');
}

如何解决此问题?

3 个答案:

答案 0 :(得分:1)

由于我无法查看您的代码

所以您正在扩大视野

@extends('layouts.app')

所以我的假设是您不见了

单引号

@extends(layouts.app)

我会给你错误

尝试添加单引号或双引号

答案 1 :(得分:0)

您也可能使用错误的单引号复制/粘贴代码:

  

@include('layouts.includes.header')<=这里用撇号代替引号

将替换为

  

@include('layouts.includes.header')

答案 2 :(得分:0)

如果遇到此类问题,原因之一是当您在frontend(view)中声明变量时,您忘记了以正确的语法声明该变量,例如我们 您这样声明{{$ user-description}},然后错误地声明了错误的语法,因为正确的语法是{{$ user-> description}} enter image description here