Version_DefaultComponentForm.php
namespace ComponentManagement\Form;
class Version_DefaultComponentForm extends VersionForm {
public function __construct($name = null) {
ComponentManagementController.php
namespace ComponentManagement\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use ComponentManagement\Form;
use ComponentManagement\Model\Component;
class ComponentManagementController extends AbstractActionController {
protected $albumTable;
public function indexAction() {
$componentForm = new Form\ComponentForm();
$versionForm = new Form\VersionForm();
$version_DefaultComponentForm = new Form\Version_DefaultComponentForm();
我收到了这个错误:
致命错误:第15行的D:\ WEB \ xampp \ htdocs_zend \ module \ ComponentManagement \ src \ ComponentManagement \ Controller \ ComponentManagementController.php中找不到类'ComponentManagement \ Form \ Version_DefaultComponentForm
我自己找不到任何错误...有谁能告诉我为什么?使用php 5.4.7 with zend 2.0
不知道为什么,但它现在正常运作。
namespace ComponentManagement\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use ComponentManagement\Form;
use ComponentManagement\Model\Component;
class ComponentManagementController extends AbstractActionController {
public function indexAction() {
$componentForm = new Form\ComponentForm();
$versionForm = new Form\VersionForm();
$request = $this->getRequest();
if ($request->isPost()) {
$component = new Component();
$componentForm->setInputFilter($component->getInputFilter());
$componentForm->setData($request->getPost());
if ($componentForm->isValid()) {
}
}
return array('forms' => array(
'ComponentForm' => $componentForm,
'VersionForm' => $versionForm,
)
);
}
答案 0 :(得分:1)
http://framework.zend.com/manual/2.0/en/modules/zend.loader.standard-autoloader.html
Zend \ Loader \ StandardAutoloader设计为符合PSR-0标准 自动加载磁带机。它假定命名空间+类名称的1:1映射 filesystem,其中名称空间分隔符和下划线是 翻译成目录分隔符。 :P