致命错误:未捕获错误:在C:\ wamp64 \ www \ Hospital \ index.php中找不到类'Hospital \ Patient':7堆栈跟踪:#0 {main}

时间:2018-02-21 10:37:33

标签: php namespaces composer-php

这是我得到的错误:

  

致命错误:未捕获错误:未找到“医院\病人”类   C:\ wamp64 \ www \ Hospital \ index.php:7堆栈跟踪:#0 {main}引入   第7行的C:\ wamp64 \ www \ Hospital \ index.php

这是index.php

<?php

require ("vendor/autoload.php");

use Hospital\Patient;

$patient = new Patient("asd","ad","asd","asd","asd");

var_dump($patient);

这是patient.php

<?php

namespace Hospital;

class Patient extends Person
{
     public function __construct($name, $age, $eyecolor, $height, $weight)
     {
        parent::__construct($name, $age, $eyecolor, $height, $weight);
     }
 }

这是composer.json

{
  "autoload":{
   "psr-4":{
    "Hospital//": ""
   }
  }
}
有人请求告诉我我做错了什么吗? 如果你错过了信息,请告诉我,我是新手。

0 个答案:

没有答案