Search code examples
laravelcsrf-token

Unknown errors using csrf_token. Laravel


I need to connect some files, using csrf_token (from laravel), but i have unknown errors such as:

  • <link rel="stylesheet" href="{{ asset('css/app.css) }}">
    syntax error, unexpected ''css/app.css)); ?>">' (T_ENCAPSED_AND_WHITESPACE)
  • <script> var BASE_URL = '{{ URL::to('/') }}'; </script>
    syntax error, unexpected '?'
  • <script src="{{ asset('js/app.js') }}"></script>
    syntax error, unexpected 'js' (T_STRING), expecting ')'

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>Auth</title>

        <link rel="stylesheet" href="{{ asset('css/app.css) }}">

    </head>
    <body>
        <div id="app"></div>

        <script>
            var BASE_URL = '{{ URL::to('/') }}';
        </script>

        <script src="{{ asset('js/app.js') }}"></script>
    </body>
</html>


Solution

  • You have missed a quote

    instead of

    <link rel="stylesheet" href="{{ asset('css/app.css) }}">
    

    use

    <link rel="stylesheet" href="{{ asset('css/app.css') }}">