zend_framework的问题高手请指导一下,万分感谢
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