當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Injector::getPath方法代碼示例

本文整理匯總了PHP中Injector::getPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP Injector::getPath方法的具體用法?PHP Injector::getPath怎麽用?PHP Injector::getPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Injector的用法示例。


在下文中一共展示了Injector::getPath方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: instantiate

 /**
  * Act as an internal constructor.
  * 
  * @param Request request, the request
  * @param Response response, the response
  */
 private function instantiate(Request $request, Response $response)
 {
     // class memebers
     $this->request = $request;
     $this->response = $response;
     $this->params = $request->getParameters();
     $this->logger = Registry::get('__logger');
     $this->injector = Registry::get('__injector');
     $this->config = Registry::get('__configurator');
     $this->session = $request->getSession();
     $this->app_path = $this->injector->getPath('__base');
     $this->template_root = $this->injector->getPath('views') . $this->params['controller'] . DIRECTORY_SEPARATOR;
     $this->template = ActionView::factory('php');
     // register session container if any
     // TODO: this should be moved elsewhere
     if ($this->config->getWebContext()->session !== NULL && $this->config->getWebContext()->session->container !== NULL) {
         // container location.
         $c_location = str_replace('.', DIRECTORY_SEPARATOR, (string) $this->config->getWebContext()->session->container) . '.php';
         include_once $c_location;
         // container class name.
         $e = explode('.', (string) $this->config->getWebContext()->session->container);
         // reflect on container.
         $container = new ReflectionClass(end($e));
         if ($container->implementsInterface('ISessionContainer')) {
             $this->session->setContainer($container->newInstance());
         }
     }
     // predefined variables:
     // TODO: check if we have a / at the end, if not, add one
     $this->template->assign('__base', (string) $this->config->getWebContext()->document_root);
     $this->template->assign('__server', (string) $this->config->getWebContext()->server_name);
     $this->template->assign('__controller', $this->params['controller']);
     $this->template->assign('__version', Medick::getVersion());
     $this->template->assign('__self', $this->__base . $this->request->getRequestUri());
     $this->logger->debug($this->request->toString());
 }
開發者ID:BackupTheBerlios,項目名稱:medick-svn,代碼行數:42,代碼來源:Base.php


注:本文中的Injector::getPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。