Chuyển đến nội dung chính

Bài đăng

Đang hiển thị bài đăng từ Tháng 10, 2015

GetUrl in Magento 2

review file \Magento\Store\Model\Store.php public function getBaseUrl($type = \Magento\Framework\UrlInterface::URL_TYPE_LINK, $secure = null) { $cacheKey = $type . '/' . ($secure === null ? 'null' : ($secure ? 'true' : 'false')); if (!isset($this->_baseUrlCache[$cacheKey])) { $secure = $secure === null ? $this->isCurrentlySecure() : (bool)$secure; switch ($type) { case \Magento\Framework\UrlInterface::URL_TYPE_WEB: $path = $secure ? self::XML_PATH_SECURE_BASE_URL : self::XML_PATH_UNSECURE_BASE_URL; $url = $this->getConfig($path); break; case \Magento\Framework\UrlInterface::URL_TYPE_LINK: $path = $secure ? self::XML_PATH_SECURE_BASE_LINK_URL : self::XML_PATH_UNSECURE_BASE_LINK_URL; $url = $this->getConfig($path);