php - Fatal error: Uncaught error class not found, but the path and folder are correct
one text
I'm having a problem with "Uncaught Error", even importing from the right folder, I already checked the path, but everything is correct.
In this part is where I need to use the class, I'm importing correctly:
<?php
use \App\Feed\Contabeis;
$obFeed = new Contabeis;
And here, I'm creating the class:
<?php
namespace App\Feed;
class Contabeis {
const FEED_URL = 'https://www.contabeis.com.br/rss/conteudo/';
private $feed = null;
public function __construct() {
$this->loadFeed();
}
private function loadFeed() {
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => self::FEED_URL,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
]);
$response = curl_exec($curl);
curl_close($curl);
return $this->parseXML($response);
}
private function parseXML($response) {
if(!strlen($response)) return false;
$this->feed = simplexml_load_string($response);
return true;
}
public function getTitle() {
return $this->feed->channel->title;
}
public function getItems() {
return $this->feed->channel->item;
}
}
?>
Message Error:
Source[::1]:53700 [200]: GET / - Uncaught Error: Class "App\Feed\Contabeis" not found in /home/carlosszpiro/Documentos/Estudos/PHP/RSS/includes/feed.php:5
Stack trace:
#0 /home/carlosszpiro/Documentos/Estudos/PHP/RSS/index.php(6): require()
#1 {main} thrown in /home/carlosszpiro/Documentos/Estudos/PHP/RSS/includes/feed.php on line 5