我一直在努力解决这个问题.这很可能是菜鸟/错字问题,但我找不到它.
我有这堂课......
<?php
namespace PriceOrQuality\POQBundle\RegExConf;
use PriceOrQuality\POQBundle\RegExConf\RegExConf;
class RegExConfIrma extends RegExConf {
public function __construct() {
$this->start_page = 'https://irma.dk';
$this->startConnection();
$this->getAllLinks();
}
}
?>
Run Code Online (Sandbox Code Playgroud)
我正试图从这个控制器加载.
<?php
// src/PriceOrQuality/POQBundle/Controller/CrawlerController.php;
namespace PriceOrQuality\POQBundle\Controller;
use PriceOrQuality\POQBundle\RegExConf\RegExConfIrma;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Monolog\Logger;
use Monolog\Handler\FirePHPHandler;
Class CrawlerController extends Controller {
public function testAction($page) {
if($page == 'irma') {
$regex = new RegExConfIrma();
return $this->render('PriceOrQualityBundle:Crawling:crawling_test.html.twig', array('links' => $regex->getLinks()));
}
}
}
?>
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个错误,我似乎无法找到问题.
FatalErrorException:错误:在/Users/Rune/Sites/poq/src/PriceOrQuality/POQBundle/Controller/CrawlerController.php第16行中找不到类'PriceOrQuality\POQBundle\RegExConf\RegExConfIrma'
RegExConfIrma位于/ Users/Rune/Sites/poq/src/PriceOrQuality/POQBundle/RegExConf/RegExConfIrma
我试图调试:*命名空间*清除缓存*更改命名空间
但没有任何帮助.
任何帮助都非常感谢.
谢谢!
这个问题非常新秀.
我忘了在我的文件扩展名后添加.php,因为我使用Netbeans,其中徽标显示为php文件,但没有正确的扩展名.
所以对于其他人发现这个帖子有同样的问题: