Symfony2-找不到类 [英] Symfony2 - Class Not Found

查看:59
本文介绍了Symfony2-找不到类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在/src/Common目录下添加了自定义类,如此处所述,我做了链接中所述的所有操作,但没有不行我不明白为什么.预先感谢您的帮助.

I have added custom class under /src/Common directory as described here I do everything as described in link but it doesn't work. I can't understand why. Thank you in advance for help.

自定义类:HttpClient.class.php

Custom Class: HttpClient.class.php

namespace Common;

class HttpClient {...

控制器:

use Common\HttpClient;

$httpClient = new HttpClient();

错误:

FatalErrorException:错误:在...中找不到类'Common \ HttpClient'

FatalErrorException: Error: Class 'Common\HttpClient' not found in ...

推荐答案

问题是我的课程扩展.是.class.php,我将其更改为.php,现在一切正常.

Problem is my class exstension. It was .class.php and I changed it to .php and everything works now.

这篇关于Symfony2-找不到类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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