Laravel不会加载我的javascript文件

I have a javascript file in /public/js/ called myjavascript.js .

I want to include it in my site.

So I did this:

@extends('something')

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

@section('content')
...

This work in other project but not in this new one. What am I doing wrong?

Try like this

<script src="{{ asset('/js/myjavascript.js') }}"></script>

Try this:

<script rel="text/javascript" src="{{ URL::asset('js/myjavascript.js') }}"></script>

I think your code need to update like:

{!! Html::script('js/myjavascript.js') !!}

Hope this work for you!

<script src="{{ asset('/js/myjavascript.js') }}"></script> is perfect.

Check your APP_URL from .env file.

if your APP_URL=www.example.com then your source will be www.example.com/js/myjavascript.js

if your APP_URL=example.com/laravel then your source will be www.example.com/laravel/js/myjavascript.js
Check 'https://github.com/laravel/framework/blob/5.4/src/Illuminate/Foundation/helpers.php' for more about asset helper function