magento中图像的基本URL应该是什么?

时间:2015-12-08 11:21:57

标签: rest http magento magento2

访问Rest API(http://192.168.1.180/magento/index.php/rest/V1/products/SKU)以获取产品详细信息后,响应如下:

select * from v$version where banner like 'Oracle%';

BANNER                                                                         
--------------------------------------------------------------------------------
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production  


BANNER
--------------------------------------------------------------------------------
    CON_ID
----------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production    
         0

attribute_code键中jpg的基本URL应该是什么?

2 个答案:

答案 0 :(得分:0)

/** @return string */
function getMediaBaseUrl() {
    /** @var \Magento\Framework\ObjectManagerInterface $om */
    $om = \Magento\Framework\App\ObjectManager::getInstance();
    /** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
    $storeManager = $om->get('Magento\Store\Model\StoreManagerInterface');
    /** @var \Magento\Store\Api\Data\StoreInterface|\Magento\Store\Model\Store $currentStore */
    $currentStore = $storeManager->getStore();
    return $currentStore->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
}

答案 1 :(得分:0)

无需修改API请求。

只需添加前缀:http://magento.com/pub/media/catalog/product/

根据我的回复,新网址将是:

前缀:http://magento.com/pub/media/catalog/product/6/4/64275-152378-large.jpg