zend framework can't find Model classes?

≯℡__Kan透↙ 提交于 2019-12-08 17:21:10

问题


Yall:

I have a simple question, it might be a simple configuration issue, but I have a Model defined, and when I try to access it from a controller it fails.

The Model is in the model directory, and when I look at the quickstart app, it seems like this should work.

Here is my model:

<?php
class Application_Model_User  { 
    protected $_user;
    protected $_password;
    protected $_userId; // very simple right
}
?> 

My controller just stops.. here is the controller code:

<?php
class UserController extends Zend_Controller_Action {

    public function init() {     
    }

    public function indexAction() {
        // display login form
        $users = new Application_Model_User();
        echo "test never echos.. stopped above ? weird huh.."; // fails before ..
    }
?>

Thank you everyone,


回答1:


In application.ini

appnamespace = "Application_"

App structure:

/application/
            /models/
                   /User.php

Class definition:

class Application_Model_User {}

Should work OK.



来源:https://stackoverflow.com/questions/2509637/zend-framework-cant-find-model-classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!