使用Composer安装Slim时找不到Class Slim [英] Class Slim not found when installing slim with composer

查看:192
本文介绍了使用Composer安装Slim时找不到Class Slim的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了有关苗条框架的说明。在我的目录中创建了composer.json文件

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

如苗条框架中的文档所述,我创建了一个index.php文件,并需要vendor / autoload.php

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.

谢谢

推荐答案

尝试使用命名空间 >实例化类时……像这样 new \Slim\Slim();

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

这篇关于使用Composer安装Slim时找不到Class Slim的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆