当前位置: 首页>>代码示例>>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;未经允许,请勿转载。