zend框架找不到模型类? [英] zend framework can't find Model classes?

查看:96
本文介绍了zend框架找不到模型类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

这是我的模特:

<?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 ..
    }
?>

谢谢大家

推荐答案

application.ini

appnamespace = "Application_"

应用程序结构:

/application/
            /models/
                   /User.php

类定义:

class Application_Model_User {}

应该可以.

这篇关于zend框架找不到模型类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆