Slim 3 autoloader

后端 未结 2 1701
面向向阳花
面向向阳花 2021-01-05 15:18

I\'m new to slim framework, and can\'t figure out how to use the autoloader to autoload my classes.

I created a app/models/myclass.php but of course wh

2条回答
  •  日久生厌
    2021-01-05 16:02

    Add this in composer.json file Where app1 is the name of the folder you want to Autoload.

    "autoload": {
        "psr-4":{
            "app1\\": "anything"
        }
    }
    

    After doing this run this in cmd (via composer)

    composer dump-autoload -o
    

提交回复
热议问题