Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
向Laravel页面添加JS脚本_Laravel_Laravel 4_Blade - Fatal编程技术网

向Laravel页面添加JS脚本

向Laravel页面添加JS脚本,laravel,laravel-4,blade,Laravel,Laravel 4,Blade,我正在尝试创建我的第一个Laravel站点,但我不知道如何将JS文件添加到我的一个页面中 我只想在这个页面上使用JS文件,而不想在其他地方使用 如何让我的页面加载JS文件 我的目录结构如下: apply js myjsfile.js apply.blade.php 在我的apply.blade.php中 @extends('layouts.master') @section('content') <div class="row"> <

我正在尝试创建我的第一个Laravel站点,但我不知道如何将JS文件添加到我的一个页面中

我只想在这个页面上使用JS文件,而不想在其他地方使用

如何让我的页面加载JS文件

我的目录结构如下:

apply
    js
        myjsfile.js
    apply.blade.php

在我的apply.blade.php中

@extends('layouts.master')

@section('content')
<div class="row">
    <div id="applicationForm" class="col-md-9 col-xs-12">
    ...
    </div>
</div>
@extends('layouts.master'))
@节(“内容”)
...
layouts.master文件

<!DOCTYPE html>
<html>
    <head>
        @include('includes.head') 
    </head>

    <body>
        <div class="container">
        <div id="header">
            @include('includes.header')
        </div>
        @yield('content')
        <div id="footer">
            @include('includes.footer')
        </div>
        </div>
    </body>
</html>

@include('includes.head')
@include('includes.header')
@产量(‘含量’)
@include('includes.footer')

您的
apply.blade.php

@extends('layouts.master')

@section('content')
<div class="row">
    <div id="applicationForm" class="col-md-9 col-xs-12">
    ...
    </div>
</div>
@stop

@section('myjsfile')
    <script src="js/myjsfile.js"><script>
@stop

我将把@section位放在哪里?我希望我的所有JS文件都加载到页脚中。
<!DOCTYPE html>
<html>
    <head>
        @include('includes.head') 
    </head>

    <body>
        <div class="container">
        <div id="header">
            @include('includes.header')
        </div>
        @yield('content')
        <div id="footer">
            @include('includes.footer')
        </div>
        </div>
    @yield('myjsfile')
    </body>
</html>