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?
You wrote it yourselfindex.php,需要引入vender的autoload.php. If you use a framework, the framework itself has already implemented the class automatic loading and registration mechanism.
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
You wrote it yourself
index.php
,需要引入vender
的autoload.php
.If you use a framework, the framework itself has already implemented the class automatic loading and registration mechanism.
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
Quick fix by referencing the namespace at the top of the page