本文整理汇总了PHP中Zend_Controller_Front::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Front::run方法的具体用法?PHP Zend_Controller_Front::run怎么用?PHP Zend_Controller_Front::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Front
的用法示例。
在下文中一共展示了Zend_Controller_Front::run方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRunStatically
public function testRunStatically()
{
$request = new Zend_Controller_Request_Http('http://example.com/index/index');
$this->_controller->setRequest($request);
Zend_Controller_Front::run(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files');
}
示例2: Zend_Log_Writer_Firebug
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/* NOTE: You must have Zend Framework in your include path! */
/*
* Add our Firebug Log Writer to the registry
*/
// require_once 'Zend/Registry.php';
// require_once 'Zend/Log.php';
// require_once 'Zend/Log/Writer/Firebug.php';
$writer = new Zend_Log_Writer_Firebug();
$writer->setPriorityStyle(8, 'TABLE');
$writer->setPriorityStyle(9, 'TRACE');
$logger = new Zend_Log($writer);
$logger->addPriority('TABLE', 8);
$logger->addPriority('TRACE', 9);
Zend_Registry::set('logger', $logger);
/*
* Add our Firebug DB Profiler to the registry
*/
// require_once 'Zend/Db.php';
// require_once 'Zend/Db/Profiler/Firebug.php';
$profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
$db = Zend_Db::factory('PDO_SQLITE', array('dbname' => ':memory:', 'profiler' => $profiler));
$db->getProfiler()->setEnabled(true);
Zend_Registry::set('db', $db);
/*
* Run the front controller
*/
// require_once 'Zend/Controller/Front.php';
Zend_Controller_Front::run(dirname(dirname(__FILE__)) . '/application/controllers');
示例3: Zend_Db_Profiler_Firebug
$logger->addPriority('TRACE', 9);
Zend_Registry::set('logger',$logger);
/*
* Add our Firebug DB Profiler to the registry
*/
require_once 'Zend/Db.php';
require_once 'Zend/Db/Profiler/Firebug.php';
$profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
$db = Zend_Db::factory('PDO_SQLITE',
array('dbname' => ':memory:',
'profiler' => $profiler));
$db->getProfiler()->setEnabled(true);
Zend_Registry::set('db',$db);
/*
* Run the front controller
*/
require_once 'Zend/Controller/Front.php';
Zend_Controller_Front::run(dirname(__DIR__).'/application/controllers');
示例4: set_include_path
<?php
set_include_path(dirname(__FILE__) . '/library');
require_once 'Zend/Controller/Front.php';
Zend_Controller_Front::run(dirname(__FILE__) . "/application/controllers");
示例5: Zend_Session_Namespace
Zend_Registry::set('db', $db);
Zend_Db_Table::setDefaultAdapter($db);
$db->query('PRAGMA foreign_keys = ON');
$session = new Zend_Session_Namespace('cncnet');
if ($session->player_id) {
$table = new CnCNet_Player();
$table->ping($session->player_id);
$player = $table->select()->where('id = ?', $session->player_id)->fetchRow();
if ($player) {
Zend_Registry::set('player', $player->toArray());
} else {
unset($session->player_id);
}
unset($table);
unset($player);
}
/* check if we are in any game room, if we are, make sure the room is set to registry! */
if ($session->room_id > 0) {
$room = $db->fetchRow($db->select()->from('rooms')->join('games', 'games.id = rooms.game_id', array('game' => 'protocol'))->where('rooms.id = ?', $session->room_id));
if ($room) {
Zend_Registry::set('room', $room);
} else {
unset($session->room_id);
}
unset($room);
}
Zend_Registry::set('session', $session);
unset($session);
unset($db);
Zend_Controller_Front::run(APP_ROOT . '/include/controllers');
示例6:
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Build
* @subpackage Zend_Build_Profile
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id:$
*/
/**
* @see Zend_Controller_Front
*/
require_once 'Zend/Controller/Front.php';
Zend_Controller_Front::run('../application/controllers');
示例7: dirname
<?php
include_once dirname(__FILE__) . '/bootstrap.php';
$layout = Zend_Layout::startMvc(array('layout' => 'standard', 'layoutPath' => APPLICATION_PATH . '/views/layouts'));
$view = new Zend_View();
$view->setEncoding('UTF-8');
$view->headTitle(Zend_Registry::get('appConfig')->about->title);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('_search_pagination_control.phtml');
Zend_Paginator::setDefaultScrollingStyle('Sliding');
$frontController = Zend_Controller_Front::getInstance();
$response = new Zend_Controller_Response_Http();
$response->setHeader('Content-Type', 'text/html; charset=UTF-8', true);
$frontController->setResponse($response);
if (Zend_Registry::get('appConfig')->profiler->enabled) {
$frontController->registerPlugin(new Common_Controller_Plugin_Profiler(Zend_Registry::get('db')));
}
Zend_Controller_Front::run(APPLICATION_PATH . '/controllers');
示例8:
/*
* Save this database connection in a place where other classes can find it.
*/
Zend_Registry::set('defaultDb', $db);
Zend_Db_Table::setDefaultAdapter('defaultDb');
/*
* Most applications have a single controller directory
* and require no other configuration of the Front Controller.
* Use this static run() convenience method.
* It is considered good practice to place application files
* outside the Apache document root, but at least this index.php
* file needs to be here.
*/
Zend_Controller_Front::getInstance()->setBaseUrl('/zfgrid');
Zend_Controller_Front::getInstance()->throwExceptions(true);
Zend_Controller_Front::run("{$appDir}/controllers");
/*
* That's all! The rest is license and copyright stuff.
* Be sure to look at .htaccess in this directory,
* and then go look at app/controllers/IndexController.php.
*/
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
示例9: run
/**
* Запуск приложения
*/
public static function run($config)
{
try {
##Zend_Loader::registerAutoload(); // pre-1.8
#$autoloader = Zend_Loader_Autoloader::getInstance(); // 1.8+
#$autoloader->setFallbackAutoloader(true);
// Создание объекта конфигурации
$conf = new Zend_Config($config);
//--< Zend_Log setup
/*
if ( !Zend_Registry::isRegistered('logger') && !empty($conf->logger) )
{
$logger = new Zend_Log();
if ( !empty($conf->logger->writer) ) {
$logger->addWriter(new Zend_Log_Writer_Stream($conf->logger->writer, 'w')); // we care about log length :)
}
if ( !empty($conf->logger->firebug) ) {
$logger->addWriter(new Zend_Log_Writer_Firebug());
}
Zend_Registry::set('logger', $logger);
l($_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . ' START');
#$filter = new Zend_Log_Filter_Priority(Zend_Log::WARN);
#$writer->addFilter($filter);
#$logger = new Zend_Log($writer);
}
*/
//-->
// Занесение объекта конфигурации в реестр
Zend_Registry::set('conf', $conf);
// @todo обоснование (пока нужно только для перевода форм, более нигде)
try {
$locale = new Zend_Locale($conf->locale);
// ru_RU.UTF8 -> ru
} catch (Zend_Locale_Exception $e) {
}
Zend_Locale::setDefault($locale->toString());
Zend_Registry::set('Zend_Locale', $locale);
// Инициализация Zend_Layout, настройка пути к макетам, а также имени главного макета
Zend_Layout::startMvc(array('layoutPath' => $conf->path->layouts));
// Получение объекта Zend_Layout
$layout = Zend_Layout::getMvcInstance();
// Инициализация объекта Zend_View
#$view = new Zend_View();
$view = $layout->getView();
// since 4/28/2009
if (!isset($conf->deprecated->noobjectkey)) {
$view->partial()->setObjectKey('model');
$view->partialLoop()->setObjectKey('model');
}
// Настройка расширения макетов
#$layout->setViewSuffix('tpl');
// Задание базового URL
$view->baseUrl = $conf->url->base;
// Задание пути для view части
$view->setBasePath($conf->path->views);
// Сначала скрипт ищется в проекте, а уже потом - в общей либе
$view->addScriptPath($conf->path->viewsCommon . "scripts");
// 53.2.3. View Script Paths: http://framework.zend.com/manual/en/zend.view.controllers.html#zend.view.controllers.script-paths
$view->addScriptPath($conf->path->views . "scripts");
//@todo!
#$res = $view->getScriptPaths();
#echo "DEBUG:<br><textarea rows=10 cols=100>" . print_r($res, 1) . "</textarea><br>";die;
#[0] => /mnt/win_d/srv.ntfs/sites/php/zf_ed/application/views/scripts/
#[1] => /srv/sites/php/library/Zx/application/views/scripts/
#[2] => /mnt/win_d/srv.ntfs/sites/php/zf_ed/application/views/scripts/
$view->addHelperPath('Zx/View/Helper/', 'Zx_View_Helper');
// 53.4.2. Helper Paths: http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.paths
// Установка объекта Zend_View
$layout->setView($view);
// Настройка расширения view скриптов с помощью Action помошников
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
#$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); // использование помощника действия вне контроллера действия
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
#Zend_Controller_Action_HelperBroker::addPrefix('Zx_Controller_Action_Helper');
// Создание объекта front контроллера
$frontController = Zend_Controller_Front::getInstance();
//--< Подключение файла с правилами маршрутизации
$router = $frontController->getRouter();
if (!isset($conf->deprecated->routes)) {
$router->addConfig(new Zend_Config_Ini($conf->path->configs . 'routes.ini', 'default'), 'routes');
} else {
require $conf->path->settings . 'routes.php';
}
#if ($conf->routes) {$frontController->setRouter($router);}
//-->
$frontController->setBaseUrl($conf->url->base)->throwexceptions(true);
self::_initCache($conf);
self::_initDb();
self::_initFrontController($frontController, $conf);
self::_initZFDebug();
// ZFDebug_Controller_Plugin_Debug
// Smartycode_Http_Conditional (http://smartycode.com/performance/zend-framework-browser-caching/)
//.........这里部分代码省略.........