Class Slim not found when installing slim with composer

余生颓废 提交于 2019-12-24 12:50:24

问题


I followed the instruction on slim framework. Created a composer.json file in my directory

{
    "require": {
        "slim/slim": "2.*"
    }
}

and run composer install file. I have the following directory structure now

As described in the documentation at slim framework i created an index.php file and require the vendor/autoload.php

But i am getting Class not found error.

Thanks


回答1:


Try using namespaces when instantiating classes ... like so new \Slim\Slim();.



来源:https://stackoverflow.com/questions/28126614/class-slim-not-found-when-installing-slim-with-composer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!