ホームページ  >  記事  >  バックエンド開発  >  ZF のみを使用してアクセスすると、空白のページが表示されますか?解決方法

ZF のみを使用してアクセスすると、空白のページが表示されますか?解決方法

WBOY
WBOYオリジナル
2016-06-13 13:49:24886ブラウズ

只用了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
--------------------- ----------------------------
クラス IndexController は Zend_Controller_Action{

関数を拡張しますinit(){
$this->registry = Zend_Registry::getInstance();
$this->view = $this->registry['view'];
$this-> ;view->baseUrl = $this->_request->getBaseUrl();
}

functionindexAction(){
$this->view->word = 'へへ';
$this->view->render('index.html');
}

}
?>
------ ----------------------------------------
index.html
----------------------------------------------- -
$this->word;
?>
はは
------ -------------------------------------------------- ---
访问出现空白页面?

-----解决方案---------
functionindexAction(){
echo'test';
exit;
$this->view->word = 'へへ';
$this->view->render( 'index.html');
}
このようなテストでは、印刷出力テストがないことを確認し、最初にこのアクションが入っているかどうかを確認します。打开
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。