当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Application::run方法代码示例

本文整理汇总了PHP中Zend_Application::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Application::run方法的具体用法?PHP Zend_Application::run怎么用?PHP Zend_Application::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Application的用法示例。


在下文中一共展示了Zend_Application::run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doRequest

 public function doRequest($request)
 {
     // redirector should not exit
     $redirector = \Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $redirector->setExit(false);
     // json helper should not exit
     $json = \Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $zendRequest = new \Zend_Controller_Request_HttpTestCase();
     $zendRequest->setMethod($request->getMethod());
     $zendRequest->setCookies($request->getCookies());
     $zendRequest->setParams($request->getParameters());
     // Sf2's BrowserKit does not distinguish between GET, POST, PUT etc.,
     // so we set all parameters in ZF's request here to not break apps
     // relying on $request->getPost()
     $zendRequest->setPost($request->getParameters());
     $zendRequest->setRawBody($request->getContent());
     $zendRequest->setRequestUri(str_replace('http://localhost', '', $request->getUri()));
     $zendRequest->setHeaders($this->extractHeaders($request));
     $_FILES = $this->remapFiles($request->getFiles());
     $_SERVER = array_merge($_SERVER, $request->getServer());
     $zendResponse = new \Zend_Controller_Response_HttpTestCase();
     $this->front->setRequest($zendRequest)->setResponse($zendResponse);
     ob_start();
     try {
         $this->bootstrap->run();
     } catch (\Exception $e) {
         ob_end_clean();
         throw $e;
     }
     ob_end_clean();
     $this->zendRequest = $zendRequest;
     $response = new Response($zendResponse->getBody(), $zendResponse->getHttpResponseCode(), $this->formatResponseHeaders($zendResponse));
     return $response;
 }
开发者ID:kansey,项目名称:yii2albom,代码行数:35,代码来源:ZF1.php

示例2: doRequest

 public function doRequest($request)
 {
     // redirector should not exit
     $redirector = \Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $redirector->setExit(false);
     // json helper should not exit
     $json = \Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $zendRequest = new \Zend_Controller_Request_HttpTestCase();
     $zendRequest->setMethod($request->getMethod());
     $zendRequest->setCookies($request->getCookies());
     $zendRequest->setParams($request->getParameters());
     $zendRequest->setRequestUri(str_replace('http://localhost', '', $request->getUri()));
     $zendRequest->setHeaders($request->getServer());
     $_FILES = $request->getFiles();
     $_SERVER = array_merge($_SERVER, $request->getServer());
     $zendResponse = new \Zend_Controller_Response_HttpTestCase();
     $this->front->setRequest($zendRequest)->setResponse($zendResponse);
     ob_start();
     $this->bootstrap->run();
     ob_end_clean();
     $this->zendRequest = $zendRequest;
     $response = new Response($zendResponse->getBody(), $zendResponse->getHttpResponseCode(), $zendResponse->getHeaders());
     return $response;
 }
开发者ID:NaszvadiG,项目名称:ImageCMS,代码行数:25,代码来源:ZF1.php

示例3: run

 /**
  * Display the generic error page for all otherwise-uncaught exceptions.
  */
 public function run()
 {
     try {
         return parent::run();
     } catch (Exception $e) {
         $this->_displayErrorPage($e);
         exit;
     }
 }
开发者ID:kyfr59,项目名称:cg35,代码行数:12,代码来源:Application.php

示例4: doRequest

 public function doRequest($request)
 {
     // redirector should not exit
     $redirector = \Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $redirector->setExit(false);
     // json helper should not exit
     $json = \Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $zendRequest = new \Zend_Controller_Request_HttpTestCase();
     $zendRequest->setMethod($request->getMethod());
     $zendRequest->setCookies($request->getCookies());
     //$zendRequest->setParams($request->getParameters());
     if (strtoupper($request->getMethod()) == 'GET') {
         $_GET = $this->remapRequestParameters($request->getParameters());
     }
     if (strtoupper($request->getMethod()) == 'POST') {
         $_POST = $this->remapRequestParameters($request->getParameters());
     }
     $zendRequest->setRequestUri(str_replace('http://localhost', '', $request->getUri()));
     $zendRequest->setHeaders($request->getServer());
     $_FILES = $this->remapFiles($request->getFiles());
     // это нужно для нормальной работы SE
     $_SERVER['HTTP_HOST'] = str_replace('http://', '', $this->host);
     if (isset($_SERVER['HTTP_REFERER'])) {
         $_SERVER['HTTP_REFERER'] = str_replace('http://localhost', '', $_SERVER['HTTP_REFERER']);
     }
     //$_SERVER['SERVER_SOFTWARE'] = '';
     $_SERVER['REQUEST_METHOD'] = strtoupper($request->getMethod());
     $_SERVER['REQUEST_URI'] = str_replace('http://localhost', '', $request->getUri());
     $zendResponse = new \Zend_Controller_Response_Http();
     $this->bootstrap->getBootstrap()->getContainer()->frontcontroller->setRequest($zendRequest)->setResponse($zendResponse);
     ob_start();
     $this->bootstrap->run();
     ob_end_clean();
     $this->zendRequest = $zendRequest;
     $headers['Content-type'] = "text/html; charset=UTF-8";
     $response = new Response($zendResponse->getBody(), $zendResponse->getHttpResponseCode(), $headers);
     return $response;
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:39,代码来源:SocialEngine.php

示例5: defined

    // Define application environment
    /** @noinspection PhpConstantReassignmentInspection */
    defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production');
    // Ensure library/ is on include_path
    set_include_path(implode(PATH_SEPARATOR, array(APPLICATION_PATH, realpath(APPLICATION_PATH . '/../vendor/zendframework/zendframework1/library'), get_include_path())));
    /** @noinspection PhpIncludeInspection */
    require_once '../vendor/autoload.php';
    //    require_once '../library/Zend/Loader/AutoloaderFactory.php';
    //    require_once '../library/Zend/Loader/ClassMapAutoloader.php';
    Zend_Loader_AutoloaderFactory::factory(array('Zend_Loader_StandardAutoloader' => array('prefixes' => array('Zend' => realpath(__DIR__ . '/../vendor/zendframework/zendframework1/library/Zend'), 'application' => APPLICATION_PATH), 'fallback_autoloader' => true)));
    /** Zend_Application */
    //require_once 'Zend/Application.php';
    // Create application, bootstrap, and run
    $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
    $application->bootstrap();
    $application->run();
} catch (Exception $e) {
    try {
        $guid = Dfi_Error_Report::saveException($e);
    } catch (Exception $e) {
        $guid = false;
    }
    if (APPLICATION_ENV != 'development') {
        $url = "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s://" : "://") . $_SERVER['HTTP_HOST'] . '/';
        header("Location: " . $url . "error/error" . ($guid ? '/guid/' . $guid : ''));
        exit;
    } else {
        echo '<pre>REPORT: ' . ($guid ? $guid : 'brak') . "\n";
        echo 'REQUEST: ' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . "\n";
        echo 'REFERER: ' . (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '') . "\n";
        echo 'ERROR: ' . $e->getMessage() . ' : ' . $e->getFile() . ' : (' . $e->getLine() . ')' . "\n" . $e->getTraceAsString() . '</pre>';
开发者ID:dafik,项目名称:zf-scaffold,代码行数:31,代码来源:publicIndex.php


注:本文中的Zend_Application::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。