简体   繁体   中英

how to load custom classes using slim middleware in slim framework from a folder to routes

below is my example routes i have a custom class called Category but am getting error like this Class 'app\\Category' not found

 $app->get('/category',function($request, $response, $args){
        $categories = new app\Category();
        $categories->getCategories();

    });

how to load this class in order to make use of it in slim framework V3

通过在 composer.json 中添加 autoload 块,通过 composer autoloader 加载它

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM