开发环境是win7x64/WAMPserver2.5/Phalcon-1.3.4我现在用phalcon框架做一个小站点,内部有多个功能,但是在使用multimodules时不能识别正确的moduleerror_reporting(E_ALL);classApplicationextends\Phalcon\Mvc\Application{/***RegistertheservicesheretomakethemgeneralorregisterintheModuleDefinitiontomakethemmodule-specific*/protectedfunction_registerServices(){$di=new\Phalcon\DI\FactoryDefault();$loader=new\Phalcon\Loader();/***We'rearegisteringasetofdirectoriestakenfromtheconfigurationfile*/$loader->registerDirs(array(__DIR__.'/../apps/library/',))->register();//Registeringarouter$di->set('router',function(){$router=new\Phalcon\Mvc\Router();$router->setDefaultModule("Entrance");$router->add('/:controller/:action',array('module'=>'entrance','controller'=>1,'action'=>2,));$router->add("/functions1",array('module'=>'function1','controller'=>'index','action'=>'index',));return$router;});$di->set('url',function(){$url=new\Phalcon\Mvc\Url();$url->setBaseUri('/myproject');return$url;});$this->setDI($di);}publicfunctionmain(){$this->_registerServices();//Registertheinstalledmodules$this->registerModules(array('Entrance'=>array('className'=>'Multiple\Entrance\Module','path'=>'../apps/entrance/Module.php',),'Impellerhelper'=>array('className'=>'Multiple\Function1\Module','path'=>'../apps/Function1/Module.php',),));echo$this->handle()->getContent();}}$application=newApplication();$application->main();访问http://localhost/myproject/index/index没有问题但是访问http://localhost/myproject/function1/index/index时却出现了问题,下面是xdebug的提示信息Phalcon\Mvc\Dispatcher\Exception:Multiple\Entrance\Controllers\Function1ControllerhandlerclasscannotbeloadedinD:\ProgramFiles\wamp\www\myproject\public\index.phponline79应该说提示信息还是挺明确的,就是没能载入一个类,或者说没能找到那个类,但是我清查了代码,确实都写对了。而且如果采用$router->setDefaults(array("namespace"=>"Multiple\Entrance","module"=>"entrance',"controller"=>"index","action"=>"index"));则连默认页面都会出现找不到类的错误我还到stackoverflow上面去查了,有人有类似问题,但是回答都是修改router或者修改baseuri之类,我都已经尝试过了,还是不行
30秒到达战场
相关分类