CSS未在Laravel 5.2中加载

时间:2016-06-23 09:09:05

标签: php html css laravel laravel-5.2

情况:

我正在使用Laravel创建一个Web应用程序,但目前我创建的CSS没有加载。

文件夹结构

enter image description here

Laravel版本

Laravel Framework版本5.2.36

master.blade.php代码

 <!doctype html>
<html lang="en">
  <head>
      <meta charset="UTF-8">
      <title>@yield('title')</title>
      <link rel ="stylesheet" href= "{{ URL::secure('src/css/main.css') }}">
    @yield('styles')
  </head>
<body>
  @include('includes.header')
<div class="main">
    @yield('content')
    </div>
</body>
</html>

2 个答案:

答案 0 :(得分:5)

像这样写:

<div id="embed_id"></div>
<script type="text/javascript">
  
(function(){
  var embededJavascriptElement = document.createElement("script"); 
  embededJavascriptElement.type = "text/javascript";
  embededJavascriptElement.charset= "utf-8";
  embededJavascriptElement.id = "embed_script";
  embededJavascriptElement.src = "<path to your script>";
  (document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")  [0]).appendChild(embededJavascriptElement);
 })();
</script>

答案 1 :(得分:3)

另一种选择: -

<link rel="stylesheet" href="{{ url('/') }}./src/css/main.css" type="text/css"/>