gpt4 book ai didi

php - Container.php 中的 ReflectionException 第 734 行 : Class PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker does not exist Laravel 5. 2

转载 作者:行者123 更新时间:2023-11-29 02:48:26 28 4
gpt4 key购买 nike

我正在 laravel 5.2 中安装 Laravel Stats Tracker,并添加我的提供者和门面,设置我的中间件文件、kernel.php 和 config/database.php 文件。

迁移运行我的控制台,但在我的浏览器中出现以下错误:

ReflectionException in Container.php line 734:
Class PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker does not exist

这些是我的提供商:

'providers' => [

/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,

/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,

/*
*
*/

PragmaRX\Tracker\Vendor\Laravel\ServiceProvider::class,

],

这些是我的别名:

'aliases' => [

'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,

'Tracker' => PragmaRX\Tracker\Vendor\Laravel\Facade::class,

],

这是我的 Kernel.php 文件:

<?php

namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
];

/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class,
],

'api' => [
'throttle:60,1',
],
];

/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];
}

这是我在 app/config/中的 tracker.php 文件

<?php

return [

/**
* Enable it?
*/
'enabled' => true,

/**
* Deffer booting for middleware use
*/
'use_middleware' => true,

/**
* Robots should be tracked?
*/
'do_not_track_robots' => false,

/**
* Which environments are not trackable?
*/
'do_not_track_environments' => [
// defaults to none
],

/**
* Which routes names are not trackable?
*/
'do_not_track_routes' => [
'tracker.stats.*',
],

/**
* The Do Not Track Ips is used to disable Tracker for some IP addresses:
*
* '127.0.0.1', '192.168.1.1'
*
* You can set ranges of IPs
* '192.168.0.1-192.168.0.100'
*
* And use net masks
* '10.0.0.0/32'
* '172.17.0.0/255.255.0.0'
*/
'do_not_track_ips' => [
'127.0.0.0/24' /// range 127.0.0.1 - 127.0.0.255
],

/**
* Log every single access?
*
* The log table can become huge if your site is popular, but...
*
* Log table is also responsible for storing information on:
*
* - Routes and controller actions accessed
* - HTTP method used (GET, POST...)
* - Error log
* - URL queries (including values)
*/
'log_enabled' => false,

/**
* Log SQL queries?
*
* Log must be enabled for this option to work.
*/
'log_sql_queries' => false,

/**
* If you prefer to store Tracker data on a different database or connection,
* you can set it here.
*
* To avoid SQL queries log recursion, create a different connection for Tracker,
* point it to the same database (or not) and forbid logging of this connection in
* do_not_log_sql_queries_connections.
*/
'connection' => 'tracker',

/**
* Forbid logging of SQL queries for some connections.
*
* To avoid recursion, you better ignore Tracker connection here.
*
* Please create a separate database connection for Tracker. It can hit
* the same database of your application, but the connection itself
* has to have a different name, so the package can ignore its own queries
* and avoid recursion.
*
*/
'do_not_log_sql_queries_connections' => [
'tracker'
],

/**
* Also log SQL query bindings?
*
* Log must be enabled for this option to work.
*/
'log_sql_queries_bindings' => false,

/**
* Log events?
*/
'log_events' => false,

/**
* Which events do you want to log exactly?
*/
'log_only_events' => [
// defaults to logging all events
],

/**
* What are the names of the id columns on your system?
*
* 'id' is the most common, but if you have one or more different,
* please add them here in your preference order.
*/
'id_columns_names' => [
'id'
],
/**
* Do not log events for the following patterns.
* Strings accepts wildcards:
*
* eloquent.*
*
*/
'do_not_log_events' => [
'illuminate.log',
'eloquent.*',
'router.*',
'composing: *',
'creating: *',
],

/**
* Do you wish to log Geo IP data?
*
* You will need to install the geoip package
*
* composer require "geoip/geoip":"~1.14"
*
* And remove the PHP module
*
* sudo apt-get purge php5-geoip
*
*/
'log_geoip' => false,

/**
* Do you wish to log the user agent?
*/
'log_user_agents' => false,

/**
* Do you wish to log your users?
*/
'log_users' => false,

/**
* Do you wish to log devices?
*/
'log_devices' => false,

/**
* Do you wish to log HTTP referers?
*/
'log_referers' => false,

/**
* Do you wish to log url paths?
*/
'log_paths' => false,

/**
* Do you wish to log url queries and query arguments?
*/
'log_queries' => false,

/**
* Do you wish to log routes and route parameters?
*/
'log_routes' => false,

/**
* Log errors and exceptions?
*/
'log_exceptions' => false,

/**
* A cookie may be created on your visitor device, so you can have information
* on everything made using that device on your site. *
*/
'store_cookie_tracker' => false,

/**
* If you are storing cookies, you better change it to a name you of your own.
*/
'tracker_cookie_name' => 'please_change_this_cookie_name',

/**
* Internal tracker session name.
*/
'tracker_session_name' => 'tracker_session',

/**
* ** IMPORTANT **
* Change the user model to your own.
*/
'user_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\User',

/**
* You can use your own model for every single table Tracker has.
*/

'session_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Session',

'log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Log',

'path_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Path',

'query_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Query',

'query_argument_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\QueryArgument',

'agent_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Agent',

'device_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Device',

'cookie_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Cookie',

'domain_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Domain',

'referer_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Referer',

'referer_search_term_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RefererSearchTerm',

'route_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Route',

'route_path_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RoutePath',

'route_path_parameter_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RoutePathParameter',

'error_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Error',

'geoip_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\GeoIp',

'sql_query_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQuery',

'sql_query_binding_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryBinding',

'sql_query_binding_parameter_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryBindingParameter',

'sql_query_log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryLog',

'connection_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Connection',

'event_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Event',

'event_log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\EventLog',

'system_class_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SystemClass',

/**
* Laravel internal variables on user authentication and login.
*/
'authentication_ioc_binding' => 'auth', // defaults to 'auth' in Illuminate\Support\Facades\Auth

'authenticated_check_method' => 'check', // to Auth::check()

'authenticated_user_method' => 'user', // to Auth::user()

'authenticated_user_id_column' => 'id', // to Auth::user()->id

'authenticated_user_username_column' => 'email', // to Auth::user()->email

/**
* Enable the Stats Panel?
*/
'stats_panel_enabled' => false,

/**
* Stats Panel routes before filter
*
*/
'stats_routes_before_filter' => '',

/**
* Stats Panel routes after filter
*
*/
'stats_routes_after_filter' => '',

/**
* Stats Panel routes middleware
*
*/
'stats_routes_middleware' => '',

/**
* Stats Panel template path
*/
'stats_template_path' => '/templates/sb-admin-2',

/**
* Stats Panel base uri.
*
* If your site url is http://wwww.mysite.com, then your stats page will be:
*
* http://wwww.mysite.com/stats
*
*/
'stats_base_uri' => 'stats',

/**
* Stats Panel layout view
*/
'stats_layout' => 'pragmarx/tracker::layout',

/**
* Stats Panel controllers namespace
*/
'stats_controllers_namespace' => 'PragmaRX\Tracker\Vendor\Laravel\Controllers',
];

配置完这些文件后,我运行了我的表的迁移,该过程执行无误。

但在浏览器中它会产生初始错误。

错误栈:

enter image description here

enter image description here

最佳答案

文件 Tracker.‌ php 不在目录中,我创建了一个与 TrackVisitsMiddleware.php 文件具有相同参数的文件,问题已得到纠正。我假设在 laravel 5.2 版本中安装时可能会出现此错误。

关于php - Container.php 中的 ReflectionException 第 734 行 : Class PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker does not exist Laravel 5. 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39054894/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com