只用了ZF訪問出現空白頁面?該怎麼解決
來源:互聯網
上載者:User
只用了ZF訪問出現空白頁面?
--------------------------------------------------
index.php
--------------------------------------------------
error_reporting(E_ALL|E_STRICT);
date_default_timezone_set('Asia/Shanghai');
set_include_path('.'.PATH_SEPARATOR.'./library'.PATH_SEPARATOR.'./aplication/models'.PATH_SEPARATOR.get_include_path());
require_once('Zend/Loader/Autoloader.php');
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
$registry = Zend_Registry::getInstance();
$view = new Zend_View();
$view->setScriptPath('./application/views/scripts');
$registry['view'] = $view;
$frontController = Zend_Controller_Front::getInstance();
$frontController->setBaseUrl('/')
->setParam('noViewRenderer',true)
->setControllerDirectory('./application/controllers')
->throwExceptions(true)
->dispatch();
?>
-------------------------------------------------
IndexController.php
-------------------------------------------------
class IndexController extends Zend_Controller_Action{
function init(){
$this->registry = Zend_Registry::getInstance();
$this->view = $this->registry['view'];
$this->view->baseUrl = $this->_request->getBaseUrl();
}
function indexAction(){
$this->view->word = 'hehe';
$this->view->render('index.html');
}
}
?>
--------------------------------------------------
index.html
------------------------------------------------
$this->word;
?>
haha
------------------------------------------------------------------------
訪問出現空白頁面?
------解決方案--------------------
function indexAction(){
echo'test';
exit;
$this->view->word = 'hehe';
$this->view->render('index.html');
}
這樣試試,看頁面有沒有列印出test,首先檢查下是否進入了這個action。
還有,建議你把application.ini的錯誤輸出開啟
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1