search

Home  >  Q&A  >  body text

PHP Class not found

< /p>

< /p>

The first time I used PHP, I pulled down a project (project address) from github. I created a new index.php, and then wrote the code in the picture. Why do I keep getting errors?
Do you think the path is OK?

< /p>

伊谢尔伦伊谢尔伦2798 days ago342

reply all(4)I'll reply

  • 高洛峰

    高洛峰2017-05-16 13:14:19

    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.

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-16 13:14:19

    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

    reply
    0
  • 阿神

    阿神2017-05-16 13:14:19

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

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 13:14:19

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

    reply
    0
  • Cancelreply