Ошибка страницы не найдена при получении локального файла в laravel 7 - PullRequest
0 голосов
/ 07 мая 2020
• 1000 views / html / products / chili.blade. php, здесь товар - чили.
<div class="col-md-4 services-grid">
                     <div class="history-grid-image">
                        <img src="images/Chilli Farm.jpg" class="img-responsive" alt="">
                     </div>
                     <div class="services-info">
                        <h4>Chili</h4>
                        <p>The Chili pepper is the fruit of plants from the genus capsicum which are members of nightshade family Solanaceae. 
                        <!-- Chili is extremely popular in India as it brings heat to the food. -->
                        <!-- India having a rich history of spices and mostly chili finds a place in every dish of Indian food.<br> -->
                        <!-- Medicinal properties: Capsaicin is the chemical used in plain reliever ointment.
                        Capsaicin also used in pepper spray and tear gas as chemical irritants to control the crowd in an emergency situation. -->
                        <!-- Rich in :  vitamin B6, vitamin A, iron, copper, potassium and a small amount of protein and carbohydrates.<br> -->
                        <!-- Helps in digestion, Weight loss, No Cholesterol Content. -->
                        <!-- Good for Diabetic people. -->
                        <!-- Fact : Chili was first introduced to India by the Portuguese towards the end of the century.</p> -->
                        <a class="more" href="{{ url('products-chili') }}"> Read More</a>
                     </div>
                  </div>

Вот файл описания продукта

@extends("layouts.html")

@section("title", "Chili|GreenGoodsExports")

@section("chili")

<!DOCTYPE html>
<html>
<head>

</head>
<body>

<!--banner-->
    <div class="banner-1">

    </div>  
<!--//banner-->
<!--single-page-->
<div class="single">
    <div class="container">
        <h2 class="tittle-one">Chili</h2>
                <div class="single-page-artical">
                    <div class="artical-content">
                        <h4>Chili</h4>
                        <img class="img-responsive" src="images/Chilli Farm.jpg" alt=" " style="visibility: visible; animation-delay: 0.5s; animation-name: zoomIn;">
                        <p>The Chili pepper is the fruit of plants from the genus capsicum which are members of nightshade family Solanaceae. 
                        Chili is extremely popular in India as it brings heat to the food.
                        India having a rich history of spices and mostly chili finds a place in every dish of Indian food.<br>
                        Medicinal properties: Capsaicin is the chemical used in plain reliever ointment.
                        Capsaicin also used in pepper spray and tear gas as chemical irritants to control the crowd in an emergency situation.
                        Rich in :  vitamin B6, vitamin A, iron, copper, potassium and a small amount of protein and carbohydrates.<br>
                        Helps in digestion, Weight loss, No Cholesterol Content.
                        Good for Diabetic people.
                        Fact : Chili was first introduced to India by the Portuguese towards the end of the century.</p>
                    </div>
                    <div class="artical-links">
                        <ul>
                            <li><i class="glyphicon glyphicon-calendar" aria-hidden="true"></i><span>March 10, 2016</span></li>
                            <li><a href="#"><i class="glyphicon glyphicon-user" aria-hidden="true"></i><span>admin</span></a></li>
                            <li><a href="#"><i class="glyphicon glyphicon-envelope" aria-hidden="true"></i><span>No comments</span></a></li>
                            <li><a href="#"><i class="glyphicon glyphicon-share" aria-hidden="true"></i><span>View posts</span></a></li>

                        </ul>
                    </div>
                    <div class="comment-grid-top">
                        <h3>Responses</h3>
                        <div class="comments-top-top">
                            <div class="top-comment-left">
                                <a href="#"><img class="img-responsive" src="images/co.png" alt=""></a>
                            </div>
                            <div class="top-comment-right">
                                <ul>
                                    <li><span class="left-at"><a href="#">Admin</a></span></li>
                                    <li><span class="right-at">March 10, 2016 at 10.30am</span></li>
                                    <li><a class="reply" href="#">Reply</a></li>
                                </ul>
                            <p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum is that it has a more-or-less </p>
                            </div>
                            <div class="clearfix"> </div>
                        </div>
                        <div class="comments-top-top top-grid-comment">
                            <div class="top-comment-left">
                                <a href="#"><img class="img-responsive" src="images/co.png" alt=""></a>
                            </div>
                            <div class="top-comment-right">
                                <ul>
                                    <li><span class="left-at"><a href="#">Admin</a></span></li>
                                    <li><span class="right-at">March 18, 2016 at 10.30am</span></li>
                                    <li><a class="reply" href="#">Reply</a></li>
                                </ul>
                            <p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum is that it has a more-or-less </p>
                            </div>
                            <div class="clearfix"> </div>
                        </div>
                    </div>          
                    <div class="artical-commentbox">
                        <h3>leave a comment</h3>
                        <div class="table-form">
                            <form>
                                <input placeholder="Name" type="text" required="">
                                <input placeholder="Email" type="email" required="">    
                                <input placeholder="Phone" type="text" required="">                                 
                                <textarea placeholder="Message"></textarea>
                                <input type="submit" value="Send">
                            </form>
                        </div>
                    </div>  
                </div>
            </div>
        </div>
    <!--single-page-->

</body>
</html>



@endsection

Вот веб. php код

Route::get("/products/chili", "ProductsController@chili")->name('products-chili');

Вот ProductsController. php код

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class ProductsController extends Controller
{
    public function chili() {
        return view("html.products1.chili");
}

Пожалуйста, помогите мне, спасибо ...

Ответы [ 2 ]

0 голосов
/ 10 мая 2020

Чтобы @ extends ('layout. html') был эффективным, в вашем html .blade должен быть @ yield ('chili') . php, что даст содержимое секции 'chili' из вашего chili.blade. php NB: html .blade. php содержит все необходимые CSS и JS файлы см. ниже: Для вашего html .blade. php

<!DOCTYPE html>
<html>
<head>
    <!--include-all-your-head-contents-including-meta-tags-css-links-and-js-->
    @yield('title')
</head>
<body>
    @yield('chili')
    <!--include-all-your-scripts-required-->
</body>
</html>

Для вашего chili.blade. php

@extends('layouts.html')
@section("title", "Chili|GreenGoodsExports")

@section("chili")
<!--banner-->
    <div class="banner-1">
    </div>  
<!--//banner-->
<!--single-page-->
<div class="single">
    <div class="container">
        <h2 class="tittle-one">Chili</h2>
                <div class="single-page-artical">
                    <div class="artical-content">
                        <h4>Chili</h4>
                        <img class="img-responsive" src="images/Chilli Farm.jpg" alt=" " style="visibility: visible; animation-delay: 0.5s; animation-name: zoomIn;">
                        <p>The Chili pepper is the fruit of plants from the genus capsicum which are members of nightshade family Solanaceae. 
                        Chili is extremely popular in India as it brings heat to the food.
                        India having a rich history of spices and mostly chili finds a place in every dish of Indian food.<br>
                        Medicinal properties: Capsaicin is the chemical used in plain reliever ointment.
                        Capsaicin also used in pepper spray and tear gas as chemical irritants to control the crowd in an emergency situation.
                        Rich in :  vitamin B6, vitamin A, iron, copper, potassium and a small amount of protein and carbohydrates.<br>
                        Helps in digestion, Weight loss, No Cholesterol Content.
                        Good for Diabetic people.
                        Fact : Chili was first introduced to India by the Portuguese towards the end of the century.</p>
                    </div>
                    <div class="artical-links">
                        <ul>
                            <li><i class="glyphicon glyphicon-calendar" aria-hidden="true"></i><span>March 10, 2016</span></li>
                            <li><a href="#"><i class="glyphicon glyphicon-user" aria-hidden="true"></i><span>admin</span></a></li>
                            <li><a href="#"><i class="glyphicon glyphicon-envelope" aria-hidden="true"></i><span>No comments</span></a></li>
                            <li><a href="#"><i class="glyphicon glyphicon-share" aria-hidden="true"></i><span>View posts</span></a></li>

                        </ul>
                    </div>
                    <div class="comment-grid-top">
                        <h3>Responses</h3>
                        <div class="comments-top-top">
                            <div class="top-comment-left">
                                <a href="#"><img class="img-responsive" src="images/co.png" alt=""></a>
                            </div>
                            <div class="top-comment-right">
                                <ul>
                                    <li><span class="left-at"><a href="#">Admin</a></span></li>
                                    <li><span class="right-at">March 10, 2016 at 10.30am</span></li>
                                    <li><a class="reply" href="#">Reply</a></li>
                                </ul>
                            <p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum is that it has a more-or-less </p>
                            </div>
                            <div class="clearfix"> </div>
                        </div>
                        <div class="comments-top-top top-grid-comment">
                            <div class="top-comment-left">
                                <a href="#"><img class="img-responsive" src="images/co.png" alt=""></a>
                            </div>
                            <div class="top-comment-right">
                                <ul>
                                    <li><span class="left-at"><a href="#">Admin</a></span></li>
                                    <li><span class="right-at">March 18, 2016 at 10.30am</span></li>
                                    <li><a class="reply" href="#">Reply</a></li>
                                </ul>
                            <p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum is that it has a more-or-less </p>
                            </div>
                            <div class="clearfix"> </div>
                        </div>
                    </div>          
                    <div class="artical-commentbox">
                        <h3>leave a comment</h3>
                        <div class="table-form">
                            <form>
                                <input placeholder="Name" type="text" required="">
                                <input placeholder="Email" type="email" required="">    
                                <input placeholder="Phone" type="text" required="">                                 
                                <textarea placeholder="Message"></textarea>
                                <input type="submit" value="Send">
                            </form>
                        </div>
                    </div>  
                </div>
            </div>
        </div>
    <!--single-page-->
@endsection

Подробнее см. Здесь: https://laravel.com/docs/7.x/blade

0 голосов
/ 07 мая 2020

В вашем возвращаемом представлении не должно быть

 return view("html.products.chili");

вместо

return view("html.products1.chili");

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class ProductsController extends Controller
{
    public function chili() {
        return view("html.products.chili");
    }
}
...