Version_DefaultComponentForm.php
namespace ComponentManagement\Form;
class Version_DefaultComponentForm extends VersionForm {
public function __construct($name = null) {
组件管理控制器.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 和 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,
)
);
}