PHP Composer Autoloader Class not Found Exception

前端 未结 2 776
长发绾君心
长发绾君心 2021-01-18 00:12

The title speaks itself. So here is my project structure:

|src
    |Database
        |Core
            |MySQL.php
        |Support
    start.php
|vendor
comp         


        
2条回答
  •  不知归路
    2021-01-18 00:25

    You need to include namespace when you are initializing a class:

    $mysql = new Database\Core\MySQL();
    

    or

    use Database\Core\MySQL;
    $mysql = new MySQL();
    

    See Using namespaces: Aliasing/Importing

提交回复
热议问题