How to get image in PHTML file?
-
15-04-2021 - |
質問
Image path -> app/design/frontend/Mycustom/Mytheme/web/image/one.png how to get image in PHTML (app/design/frontend/Mycustom/Mytheme/Magento_Search/templates/form.mini.phtml) file,
<?php echo __('Search');?>
I need to show image instead of text Search, any help thanks.
解決
You can call static images in phtml by:
<img src='<?php echo $this->getViewFileUrl('images/my-logo.png'); ?>' alt="Logo">
Img Path:
app/design/frontend/{Package}/{theme}/web/images/my-logo.png
Ref: link
所属していません magento.stackexchange