为什么找不到带命名空间的类?
错误:
致命错误:Class' MyDB \ Panel \ User' /Applications/AMPPS/www/slim/index.php 22
<
根&GT; composer.json
{
"require": {
"slim/slim": "^3.0",
"slim/twig-view": "^2.0",
"illuminate/database": "5.2.*",
"robmorgan/phinx": "0.5.*",
"vlucas/valitron": "^1.2"
},
"autoload": {
"psr-4": {
"MyDB\\": "src/"
}
}}
根&GT; SRC&GT; Panel.php
<?php namespace MyDB\Panel;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
protected $table = 'zooUser';
}
根&GT;的index.php
require 'vendor/autoload.php';
$DB = new \MyDB\Panel\User();
根&GT;卖主GT;作曲家&GT; autoload_psr4.php
'MyDB\\' => array($baseDir . '/src'),