Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/282.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
Php 调用未定义的方法Illumb\Session\Store::getToken()_Php_Laravel 5.4 - Fatal编程技术网

Php 调用未定义的方法Illumb\Session\Store::getToken()

Php 调用未定义的方法Illumb\Session\Store::getToken(),php,laravel-5.4,Php,Laravel 5.4,我试图在我的Laravel5.4项目中使用excel软件包,这是我在网上得到的一个教程,但我一直遇到这个错误 调用未定义的方法Illumb\Session\Store::getToken()(视图: C:\wamp64\www\Vidic\resources\views\file\u import\u export.blade.php)在 HtmlServiceProvider.php(第51行) 这是我的composer.json文件 { "name": "laravel/lara

我试图在我的Laravel5.4项目中使用excel软件包,这是我在网上得到的一个教程,但我一直遇到这个错误

调用未定义的方法Illumb\Session\Store::getToken()(视图: C:\wamp64\www\Vidic\resources\views\file\u import\u export.blade.php)在 HtmlServiceProvider.php(第51行)

这是我的composer.json文件

{
      "name": "laravel/laravel",
      "description": "The Laravel Framework.",
      "keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
    "php": ">=5.6.4",
    "laravel/framework": "5.4.*",
    "laravel/tinker": "~1.0",
    "maatwebsite/excel": "~2.1.0",
    "illuminate/html": "5.*"
},
"require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~5.7"
},
"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    }
},
"autoload-dev": {
    "psr-4": {
        "Tests\\": "tests/"
    }
},
"scripts": {
    "post-root-package-install": [
        "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ],
    "post-install-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postInstall",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postUpdate",
        "php artisan optimize"
    ]
},
"config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true
}
}
这是我的app.php文件

     'providers' => [
    /*
     * Laravel Framework Service Providers...
     */
    ...

    Illuminate\View\ViewServiceProvider::class,
    'Maatwebsite\Excel\ExcelServiceProvider',
    'Illuminate\Html\HtmlServiceProvider',

    'aliases' => [
    ...
    'View' => Illuminate\Support\Facades\View::class,
    'Excel' => 'Maatwebsite\Excel\Facades\Excel',
    'Form' => 'Illuminate\Html\FormFacade',
    'HTML' => 'Illuminate\Html\HtmlFacade',
],
];
这就是我的观点

            <body>
    <div class="panel panel-primary">
 <div class="panel-heading">Payments</div>
  <div class="panel-body"> 
  <div class="row">
      <div class="col-xs-12 col-sm-12 col-md-12">
        <a href="{{ route('excel-file',['type'=>'xls']) }}">Download Excel xls</a> |
        <a href="{{ route('excel-file',['type'=>'xlsx']) }}">Download Excel xlsx</a> |
        <a href="{{ route('excel-file',['type'=>'csv']) }}">Download CSV</a>
      </div>
   </div>     
       {!! Form::open(array('route' => 'import-csv-excel','method'=>'POST','files'=>'true')) !!}
        <div class="row">
           <div class="col-xs-12 col-sm-12 col-md-12">
                <div class="form-group">
                    {!! Form::label('sample_file','Select File to Import:',['class'=>'col-md-3']) !!}
                    <div class="col-md-9">
                    {!! Form::file('sample_file', array('class' => 'form-control')) !!}
                    {!! $errors->first('sample_file', '<p class="alert alert-danger">:message</p>') !!}
                    </div>
                </div>
            </div>
            <div class="col-xs-12 col-sm-12 col-md-12 text-center">
            {!! Form::submit('Upload',['class'=>'btn btn-primary']) !!}
            </div>
        </div>
       {!! Form::close() !!}
 </div>
</div>

付款
|
|
{!!Form::open(数组('route'=>'import csv excel','method'=>'POST','files'=>'true'))
{!!Form::label('sample_file','Select file to Import:',['class'=>'col-md-3'])
{!!Form::file('sample_file',array('class'=>'Form control'))
{!!$errors->first('sample_file','p class=“alert-alert-danger”>:message

) {!!表单::提交('Upload',['class'=>'btn btn primary']) {!!Form::close()!!}
我已经将HtmServiceProvider.php文件中的大多数方法(如bindShared()重命名为singleton()),但这没有帮助。
我缩短了代码,使其易于理解

尝试使用本教程。找到它

这对我很有效:将
getToken()
更改为
token()


1-在您的项目中,转到以下文件

vendor\laravelcollective\html\src\HtmlServiceProvider.php

2-在RegisterPerformBuilder()方法/函数中,将getToken()更改为token()


我希望它也能对您起作用。

我已经获得了要加载的表单,但是在导入Excel facade后,当单击导入时,我在DebitController.php(第89行)中未找到此错误类“App\Http\Controllers\Excel”,我遇到了其他错误,失去了希望,只能在以后解决。看起来那个教程已经被删除了。我认为在laravel源文件中更改任何内容都不是一个好主意。