PHP Class not found
伊谢尔伦
伊谢尔伦 2017-05-16 13:12:19
0
4
296

第一次使用PHP,从github上拉下来一个项目(项目地址),我新建了一个index.php,然后写下图中代码,为什么一直报错呢?
路径觉得没问题啊?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(4)
小葫芦

You wrote it yourselfindex.php,需要引入venderautoload.php.
If you use a framework, the framework itself has already implemented the class automatic loading and registration mechanism.

大家讲道理
https://getcomposer.org/
http://www.phpcomposer.com/

Look at the composer's documentation. vendor is the composer's library directory. If you want to use it directly, you can use a relative directory reference.
General use should be to introduce the autoload.php file in the vendor directory outside the vendor directory

阿神

The autoloading function is not registered and the class is not loaded

Ty80

Quick fix by referencing the namespace at the top of the page

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!