[英]HTML Error - Reading @include as text (Laravel5)
I'm having a small and stupid issue with my code . 我的代码有一个小而愚蠢的问题。 I recently started using laravel after a long time and they made some changes to the syntax tho i don;t think that's the issue here . 我很久以后才开始使用laravel,他们对语法做了一些更改,但我认为这不是问题所在。 I think i made an error when writing my basic html . 我认为编写基本html时出错。
my @include is showing up as text and even when i'm commenting out the line - the whole thing is showing up as text too . 我的@include显示为文本,甚至当我注释掉该行时-整个事情也显示为文本。
(I'm using notepad++) (我正在使用记事本++)
page.php page.php文件
@extends('layouts.layout')
layout.php layout.php中
<!DOCTYPE html>
<html lang="en">
<head>
//@include('includes.head')
<link href="{{ asset('/css/style.css') }}" rel="stylesheet">
<style>
body
{
background-color: #B0BEC5;
}
</style>
</head>
<body>
<footer>
</footer>
</body>
</html>
Result : 结果:
I also added the style directly in the head to test as for some reason , its not reading my style.css file either . 由于某种原因,我还直接在样式中添加了样式以进行测试,它也不读取我的style.css文件。
style.css style.css文件
html,body
{
height: 100%;
background-color:red;
}
footer {
height: 50px;
background-color: black;
}
If you want to comment. 如果您想发表评论。 You shall follow the laravel way of commenting as you're already in it. 您应该已经按照laravel的方式发表评论了。
{{-- This comment will not be present in the rendered HTML --}}
However, You should have the files name with extension .blade.php
if you want to use it as layouts or extending it. 但是,如果要将其用作布局或扩展它,则应使用扩展名为.blade.php
的文件名。 Else your {{
tags won't get effect and so your .css
or .js
files won't load too, which results in plain html as output. 否则您的{{
标记将不会生效,因此您的.css
或.js
文件也不会加载,这将导致纯HTML输出。
Refer Here to learn more about blade templates in Laravel. 请参阅此处以了解有关Laravel中刀片模板的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.