本文整理汇总了PHP中Magento\Framework\App\Request\Http::getFrontName方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::getFrontName方法的具体用法?PHP Http::getFrontName怎么用?PHP Http::getFrontName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Request\Http
的用法示例。
在下文中一共展示了Http::getFrontName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: launch
/**
* Run application
*
* @return ResponseInterface
*/
public function launch()
{
$areaCode = $this->_areaList->getCodeByFrontName($this->_request->getFrontName());
$this->_state->setAreaCode($areaCode);
$this->_objectManager->configure($this->_configLoader->load($areaCode));
$this->_response = $this->_objectManager->get('Magento\\Framework\\App\\FrontControllerInterface')->dispatch($this->_request);
// This event gives possibility to launch something before sending output (allow cookie setting)
$eventParams = array('request' => $this->_request, 'response' => $this->_response);
$this->_eventManager->dispatch('controller_front_send_response_before', $eventParams);
return $this->_response;
}
示例2: launch
/**
* Run application
*
* @return ResponseInterface
*/
public function launch()
{
try {
$areaCode = $this->_areaList->getCodeByFrontName($this->_request->getFrontName());
$this->_state->setAreaCode($areaCode);
$this->_objectManager->configure($this->_configLoader->load($areaCode));
$this->_response = $this->_objectManager->get('Magento\\Framework\\App\\FrontControllerInterface')->dispatch($this->_request);
// This event gives possibility to launch something before sending output (allow cookie setting)
$eventParams = array('request' => $this->_request, 'response' => $this->_response);
$this->_eventManager->dispatch('controller_front_send_response_before', $eventParams);
} catch (\Exception $exception) {
$message = $exception->getMessage() . "\n";
try {
if ($this->_state->getMode() == State::MODE_DEVELOPER) {
$message .= '<pre>';
$message .= $exception->getMessage() . "\n\n";
$message .= $exception->getTraceAsString();
$message .= '</pre>';
} else {
$reportData = array($exception->getMessage(), $exception->getTraceAsString());
// retrieve server data
if (isset($_SERVER)) {
if (isset($_SERVER['REQUEST_URI'])) {
$reportData['url'] = $_SERVER['REQUEST_URI'];
}
if (isset($_SERVER['SCRIPT_NAME'])) {
$reportData['script_name'] = $_SERVER['SCRIPT_NAME'];
}
}
require_once $this->_filesystem->getPath(Filesystem::PUB_DIR) . '/errors/report.php';
$processor = new \Magento\Framework\Error\Processor($this->_response);
$processor->saveReport($reportData);
$this->_response = $processor->processReport();
}
} catch (\Exception $exception) {
$message .= "Unknown error happened.";
}
$this->_response->setHttpResponseCode(500);
$this->_response->setBody($message);
}
return $this->_response;
}
示例3: launch
/**
* Run application
*
* @throws \InvalidArgumentException
* @return ResponseInterface
*/
public function launch()
{
$areaCode = $this->_areaList->getCodeByFrontName($this->_request->getFrontName());
$this->_state->setAreaCode($areaCode);
$this->_objectManager->configure($this->_configLoader->load($areaCode));
/** @var \Magento\Framework\App\FrontControllerInterface $frontController */
$frontController = $this->_objectManager->get('Magento\\Framework\\App\\FrontControllerInterface');
$result = $frontController->dispatch($this->_request);
// TODO: Temporary solution until all controllers return ResultInterface (MAGETWO-28359)
if ($result instanceof ResultInterface) {
$this->registry->register('use_page_cache_plugin', true, true);
$result->renderResult($this->_response);
} elseif ($result instanceof HttpInterface) {
$this->_response = $result;
} else {
throw new \InvalidArgumentException('Invalid return type');
}
// This event gives possibility to launch something before sending output (allow cookie setting)
$eventParams = ['request' => $this->_request, 'response' => $this->_response];
$this->_eventManager->dispatch('controller_front_send_response_before', $eventParams);
return $this->_response;
}
示例4: testGetFrontName
public function testGetFrontName()
{
$uri = 'http://test.com/one/two';
$this->_model = $this->getModel($uri);
$this->assertEquals('one', $this->_model->getFrontName());
}
示例5: testGetFrontName
public function testGetFrontName()
{
$this->_model = new Request($this->_routerListMock, $this->_infoProcessorMock, 'http://test.com/one/two');
$this->assertEquals('one', $this->_model->getFrontName());
}