How to manually add ClassLoader in Laravel 5

岁酱吖の 提交于 2019-12-14 03:55:51

问题


I want add my class to classloader by this commands

$loader = new \Composer\Autoload\ClassLoader();
$loader->addPsr4('test\\', __DIR__ . '/../..' . '/modules/test');
$loader->register();

but dose not work and no error
dd($loader):

ClassLoader {#470 ▼
  -prefixLengthsPsr4: array:1 [▼
    "t" => array:1 [▶]
  ]
  -prefixDirsPsr4: array:1 [▼
    "test\" => array:1 [▼
      0 => "C:\wamp\www\app\Http\Controllers\admin/../../modules/test"
    ]
  ]
  -fallbackDirsPsr4: []
  -prefixesPsr0: []
  -fallbackDirsPsr0: []
  -useIncludePath: false
  -classMap: []
  -classMapAuthoritative: false
}

来源:https://stackoverflow.com/questions/39545096/how-to-manually-add-classloader-in-laravel-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!