zend_framework的问题高手请指导一下,万分感谢

mjhgcxv 2013-02-21 10:50:30
IndexController.php
<?php
require_once APPLICATION_PATH.'..\models\news.php';
class IndexController extends Zend_Controller_Action
{
public function init()
{

/* Initialize action controller here */

}

public function indexAction()
{
echo "fdsa";
$messageModel=new News();
$res=$messageModel->fetchAll()->toArray();
$this->view->res=$res;
// action body
$this->render('index');
}


}
application.ini
[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0

[mysql]
db.adapter=PDO_MYSQL
db.params.host=localhost
db.params.username=root
db.params.password=root
db.params.dbname=wo
database.params.driver_options.1002 = "SET NAMES utf8"

news.php
<?php
class News extends Zend_Db_Table{
protected $_name='news';
protected $_primary='Id';
}

<?php
Bootstrap.php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{
//启动
function __construct($app){
parent::__construct($app);

$url=constant("APPLICATION_PATH").DIRECTORY_SEPARATOR.'configs'.DIRECTORY_SEPARATOR.'application.ini';
$dbconfig=new Zend_Config_Ini($url,"mysql");
$db=Zend_Db::factory($dbconfig->db);
$db->query('SET NAMES UTF8');
Zend_Db_table::setDefaultAdapter($db);


}


}
执行时提示
An error occurred
Application error
...全文
488 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
stch12132324 2013-03-05
  • 打赏
  • 举报
回复
require_once APPLICATION_PATH.'/models/news.php';
wh72238 2013-03-05
  • 打赏
  • 举报
回复
第三行,有错!这个路径系统不会认识的。绝对路径后面又加上.. 这一下回到了你的硬盘的根了都! 你的硬盘跟下有models么?

4,251

社区成员

发帖
与我相关
我的任务
社区描述
国内外优秀PHP框架讨论学习
社区管理员
  • Framework
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧