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


PHP Http::getDistroBaseUrlPath方法代碼示例

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


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

示例1: getUrl

 /**
  * Gets setup application URL
  *
  * @return string
  */
 public function getUrl()
 {
     if (isset($this->server[self::PARAM_NOT_INSTALLED_URL])) {
         return $this->server[self::PARAM_NOT_INSTALLED_URL];
     }
     return Request\Http::getDistroBaseUrlPath($this->server) . $this->getPath() . '/';
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:12,代碼來源:SetupInfo.php

示例2: testGetDistroBaseUrlPath

 /**
  * @param string $scriptName
  * @param string $expected
  * @dataProvider getDistroBaseUrlPathDataProvider
  */
 public function testGetDistroBaseUrlPath($scriptName, $expected)
 {
     $this->assertEquals($expected, Http::getDistroBaseUrlPath(['SCRIPT_NAME' => $scriptName]));
 }
開發者ID:IlyaGluschenko,項目名稱:test001,代碼行數:9,代碼來源:HttpTest.php

示例3: authPreDispatch

 /**
  * Check if user login
  *
  * @param \Zend\Mvc\MvcEvent $event
  * @return bool
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function authPreDispatch($event)
 {
     /** @var RouteMatch $routeMatch */
     $routeMatch = $event->getRouteMatch();
     $controller = $routeMatch->getParam('controller');
     if (!in_array($controller, $this->controllersToSkip)) {
         /** @var Application $application */
         $application = $event->getApplication();
         $serviceManager = $application->getServiceManager();
         if ($serviceManager->get('Magento\\Framework\\App\\DeploymentConfig')->isAvailable()) {
             /** @var \Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider */
             $objectManagerProvider = $serviceManager->get('Magento\\Setup\\Model\\ObjectManagerProvider');
             /** @var \Magento\Framework\ObjectManagerInterface $objectManager */
             $objectManager = $objectManagerProvider->get();
             /** @var \Magento\Framework\App\State $adminAppState */
             $adminAppState = $objectManager->get('Magento\\Framework\\App\\State');
             $adminAppState->setAreaCode(\Magento\Framework\App\Area::AREA_ADMIN);
             /** @var \Magento\Backend\Model\Session\AdminConfig $sessionConfig */
             $sessionConfig = $objectManager->get(\Magento\Backend\Model\Session\AdminConfig::class);
             $cookiePath = $this->getSetupCookiePath($objectManager);
             $sessionConfig->setCookiePath($cookiePath);
             /** @var \Magento\Backend\Model\Auth\Session $adminSession */
             $adminSession = $objectManager->create(\Magento\Backend\Model\Auth\Session::class, ['sessionConfig' => $sessionConfig, 'appState' => $adminAppState]);
             if (!$objectManager->get(\Magento\Backend\Model\Auth::class)->isLoggedIn()) {
                 $adminSession->destroy();
                 $response = $event->getResponse();
                 $baseUrl = Http::getDistroBaseUrlPath($_SERVER);
                 $response->getHeaders()->addHeaderLine('Location', $baseUrl . 'index.php/session/unlogin');
                 $response->setStatusCode(302);
                 $event->stopPropagation();
                 return $response;
             }
         }
     }
     return false;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:43,代碼來源:InitParamListener.php


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