我正在尝试访问我的laravel应用程序中的产品,我收到以下错误:
中的FatalErrorException /home2/switchli/public_html/switchgrow.com/laravel/storage/framework/views/8b209faa68f2ec72a2fecf832efc4c82 第14行:语法错误,意外的文件结尾
文件(8b209faa68f2ec72a2fecf832efc4c82)包含
<?php $__env->startSection('title', 'Products'); ?>
<?php $__env->startSection('content'); ?>
<?php foreach($products as $product): ?>
{
<h1><?php echo e($product->id); ?></h1>
}
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
我的控制器(ProductController)包含
<?php
namespace App\Http\Controllers;
Use App\Product;
class ProductController extends Controller {
public function index(){
$products = Product::all();
return view('products',['products' => $products]);
}
}
我的products.blade.php视图包含
@extends('layouts.master')
@section('title', 'Products')
@section('content')
@foreach ($products as $product)
{
<h1>{{$product->id}}</h1>
}
@endsection
我的layouts / master.blade.php包含
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta lang="en" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Shop Canadian LED Grow Lights for Commercial Marijuana Growing Projects" />
<meta name="robots" content="index" />
<title>Switch GROW - @yield('title')</title>
<link rel="shortcut icon" href="assets/images/logo.png" type="image/x-icon" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic&subset=latin" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,700" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" />
<link rel="stylesheet" href="assets/font-awesome-4.7.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="assets/bootstrap-material-design-font/css/material.css" />
<link rel="stylesheet" href="assets/web/assets/mobirise-icons/mobirise-icons.css" />
<link rel="stylesheet" href="assets/et-line-font-plugin/style.css" />
<link rel="stylesheet" href="assets/tether/tether.min.css" />
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="assets/dropdown/css/style.css" />
<link rel="stylesheet" href="assets/animate.css/animate.min.css" />
<link rel="stylesheet" href="assets/theme/css/style.css" />
<link rel="stylesheet" href="assets/mobirise-gallery/style.css" type="text/css" />
<link rel="stylesheet" href="assets/mobirise/css/mbr-additional.css" type="text/css" />
</head>
<body>
<div id="menu-0" custom-code="true">
<nav class="navbar navbar-dropdown
<?php
/*if (strpos($_SERVER['SCRIPT_NAME'], 'index.php') !== false) {
echo 'transparent';
}*/
?>
navbar-fixed-top">
<div class="">
<div class="mbr-table navbar-table">
<div class="mbr-table-cell navbar-cell navbar-header">
<a class="navbar-caption" href="index.php" aria-label="Home">
<!--<span style="font-weight:normal">switch</span><span style="letter-spacing:-1px">GROW</span>-->
<img src="assets/images/switch_grow_logo.svg" alt="Switch GROW Logo" class="switch_grow_logo" style="padding-left:8px" />
</a>
</div>
<div class="mbr-table-cell navbar-cell">
<button class="navbar-toggler pull-xs-right hidden-md-up" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar">
<div class="hamburger-icon"></div>
</button>
<ul class="nav-dropdown collapse pull-xs-right nav navbar-nav navbar-toggleable-sm" id="exCollapsingNavbar">
<li class="nav-item">
<a class="nav-link link mbr-editable-menu-item" href="index.html#header3-k">PRODUCTS</a>
</li>
<li class="nav-item">
<a class="nav-link link mbr-editable-menu-item" href="#">TECHNOLOGY</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link link dropdown-toggle mbr-editable-menu-item" href="index.html#pricing-table2-f" data-toggle="dropdown-submenu" aria-expanded="true">RESOURCES</a>
<div class="dropdown-menu">
<a class="dropdown-item mbr-editable-menu-item" href="residential.php"> Residential Cannabis Growing</a>
<a class="dropdown-item mbr-editable-menu-item" href="commercial_growing.php"> Commercial Cannabis Growing</a>
<a class="dropdown-item mbr-editable-menu-item" href="food_growing.php"> Food Growing</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link link mbr-editable-menu-item" href="#">CONTACT</a>
</li>
</ul>
<button hidden="" class="navbar-toggler navbar-close" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar">
<div class="close-icon"></div>
</button>
<a hidden="" class="navbar-caption navbar-close mobile-menu-logo" href="index.php" aria-label="Home" style="left:80px">
<!--<span style="font-weight:normal">switch</span><span style="letter-spacing:-1px">GROW</span>-->
<img src="assets/images/switch_grow_logo.svg" alt="Switch GROW Logo" class="switch_grow_logo" style="padding-left:8px" />
</a>
</div>
</div>
</div>
</nav>
</div>
@yield('content')
<script src="assets/web/assets/jquery/jquery.min.js">
</script>
<script src="assets/tether/tether.min.js">
</script>
<script src="assets/bootstrap/js/bootstrap.min.js">
</script>
<script src="assets/smooth-scroll/smooth-scroll.js">
</script>
<script src="assets/dropdown/js/script.min.js">
</script>
<script src="assets/touch-swipe/jquery.touch-swipe.min.js">
</script>
<script src="assets/viewport-checker/jquery.viewportchecker.js">
</script>
<script src="assets/jarallax/jarallax.js">
</script>
<script src="assets/mobirise-gallery/script.js">
</script>
<script src="assets/mobirise-gallery/player.min.js">
</script>
<script src="assets/theme/js/script.js">
</script>
<input name="animation" type="hidden" />
</body>
</html>
感谢您的帮助
答案 0 :(得分:2)