Zend Framework中找不到类(Class Not Found in Zend Framework)
我在本地工作站(Windows)上安装了zend framework 1.11.11的新副本。 对于我的管理模块,我在/application/modules/admin/models/Form/Login.php下创建了“Login.php”表单。我还在Bootstrap.php中设置了自动加载器。
protected function _initAutoloader() { $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('My_'); new Zend_Application_Module_Autoloader(array( 'basePath' => APPLICATION_PATH, 'namespace' => 'Default') ); $loader = new Zend_Loader_Autoloader_Resource(array( 'basePath' => APPLICATION_PATH.'/models/', 'namespace' => '') ); $loader->addResourceType('forms', 'Form/', 'Form'); return $autoloader; }
在我的管理模块的IndexController.php文件的loginAction()方法中,我正在使用
$form = new Admin_Model_Form_Login();
但得到以下错误: -
致命错误:在C:\ wamp \ www \ ztest \ application \ modules \ admin \ controllers \ IndexController.php中找不到类'Admin_Model_Form_Login'
这是Login.php的代码
class Admin_Model_Form_Login extends Zend_Form { public function init() { parent::init(); $this->setAction('/admin/index/login')->setMethod('post'); $account = new Zend_Form_Element_Text('account'); $account->setLabel('Username')->setRequired(true); $account->setOrder(1); $this->addElement($account); $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password'); $password->setOrder(2); $this->addElement($password); $submit = new Zend_Form_Element_Submit('login'); $submit->setLabel('Login'); $submit->setOrder(3); $this->addElement($submit); } }
I have installed a fresh copy of zend framework 1.11.11 on my local workstation (Windows). For my admin module I have created "Login.php" form under /application/modules/admin/models/Form/Login.php I have also set up autoloader in Bootstrap.php Like
protected function _initAutoloader() { $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('My_'); new Zend_Application_Module_Autoloader(array( 'basePath' => APPLICATION_PATH, 'namespace' => 'Default') ); $loader = new Zend_Loader_Autoloader_Resource(array( 'basePath' => APPLICATION_PATH.'/models/', 'namespace' => '') ); $loader->addResourceType('forms', 'Form/', 'Form'); return $autoloader; }
on my loginAction() method of IndexController.php file of admin module, i am using
$form = new Admin_Model_Form_Login();
But Getting below error:-
Fatal error: Class 'Admin_Model_Form_Login' not found in C:\wamp\www\ztest\application\modules\admin\controllers\IndexController.php
Here is the code of Login.php
class Admin_Model_Form_Login extends Zend_Form { public function init() { parent::init(); $this->setAction('/admin/index/login')->setMethod('post'); $account = new Zend_Form_Element_Text('account'); $account->setLabel('Username')->setRequired(true); $account->setOrder(1); $this->addElement($account); $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password'); $password->setOrder(2); $this->addElement($password); $submit = new Zend_Form_Element_Submit('login'); $submit->setLabel('Login'); $submit->setOrder(3); $this->addElement($submit); } }
原文:
最满意答案
尝试将顶部设置为百分比:
.text { position: absolute; top: 25%; left: 0; color: white; text-align: center; bottom: 0; right: 0; }
Try setting the top to a percentage:
.text { position: absolute; top: 25%; left: 0; color: white; text-align: center; bottom: 0; right: 0; }
相关问答
更多-
麻烦垂直居中文本(Trouble vertical centering text)[2022-03-01]
你的意思是图像上方栏中的文字? 将文本换行在p>标记中的页眉/页脚div中。 加 vertical-align:middle; 到了p。 JSFiddle 。 Finally!!! I got it to work! Thank you very much @Dave Salomon and @Eirenaios for your help! Here's the final code: (hope it helps somebody else in the future) HTML: ...
-
只需考虑图像而不是文本,并添加到图像margin-bottom:-50px (与底部相同:-50px)并简单地使用position relative,不需要absloute: .article-txt { position: relative; z-index:1; font-size:35px; font-weight:bold; padding: 0 50px; } .article-img { display: block; position: relat ...
-
每当您为固定数量的像素设置样式时,请务必在数字后面加上“px”。 #gallery_slide > p { bottom: 50px; right: -20px; } 我认为这就是你在这里要做的。 在其他情况下,您可能更喜欢使用百分比,因此您的单位为'%'。 对于ems,请使用'em',等等。 Whenever you're setting styles for a fixed number of pixels, make sure to put 'px' after the number. ...
-
问题是你不能将自动边距应用到一个固定的元素。 为了允许不同的菜单宽度,我会这样做: #abc { bottom: 0; height: 30px; /* forces #testmenu to the bottom */ margin: 0 auto; position: fixed; width: 100%; } #testmenu { background: none repeat scroll 0 0 #FF0000; bottom: 0; ...
-
有一个问题居中形象?(Having an issue centering image?)[2022-01-19]
body { margin: 0; background-image: url(http://pa2.sulmaxcp.com/IMAGES/Background.svg); background-repeat: repeat; } li { float: right; list-style-type: none; border: 2px solid #2f8fcb; border-radius: 10px; background-color: #2f ... -
尝试以下代码,只需替换您的css代码 .komentarz-main .content span{ position: relative; height: 100%; display: inline-block; } .komentarz-main .content span:after{ display: inline-block; content: ''; position: relative; width: 11px; ...
-
在Excel中居中图像(Centering image in Excel)[2023-08-07]
虽然只需通过设置页面标题即可通过ASP Classic创建简单的Excel文件,但通常需要更多控制。 请看一下: http : //www.crydust.be/blog/2009/03/02/generate-excel-files-in-asp-classic/ 代码转发形式Kristof Neirynck的博客在这里: <%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%> <% function getData(connectionString, sql){ ... -
浏览器确实处理绝对中心有点不同! 虽然在这种情况下我建议使用background-image代替更好的定位选项,但是你可以使用top: -100%来诱骗Firefox适当地居中图像top: -100%和bottom: -100% 。 这迫使Firefox开始计算,以便在容器边界之外居中,而不是在顶部启动元素而只是从底部溢出。 这是你的小提琴,已被调整以解决问题: http : //jsfiddle.net/shshaw/KgJbR/3/ Browsers do handle Absolute Centeri ...
-
位置:绝对底部:0在图像上居中文本时不起作用(position: absolute bottom: 0 not working when centering text on image)[2023-08-04]
尝试将顶部设置为百分比: .text { position: absolute; top: 25%; left: 0; color: white; text-align: center; bottom: 0; right: 0; } Try setting the top to a percentage: .text { position: absolute; top: 25%; left: 0; color: whi ... -
div { display: inline-block; position: relative; } div img { vertical-align: top; } div h2 { position: absolute; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.5); text-align: center; margin: 0; padd ...