Home >Backend Development >PHP Tutorial >用require可以引用自定义的类,用use引用自定义的类去总报错说没找到引用类?

用require可以引用自定义的类,用use引用自定义的类去总报错说没找到引用类?

WBOY
WBOYOriginal
2016-06-06 20:28:171147browse

用require可以引用自定义的类,用use引用自定义的类去总报错说没找到引用类?
我PHP是5.5.12的呢,网上说use得php5.3才可以用,但我都5.5了,怎么还用不了?

回复内容:

用require可以引用自定义的类,用use引用自定义的类去总报错说没找到引用类?
我PHP是5.5.12的呢,网上说use得php5.3才可以用,但我都5.5了,怎么还用不了?

我怀疑题主认为用了namespace就不用手动加载文件了。

按照官网下面的评论,即时使用namespace也是要手动加载文件的

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:linux环境开发,选什么系统?Next article:doctrine分表