[英]how to find if an image exists or not in tpl files (smarty)?
我必須檢查給定路徑中是否存在文件。 我嘗試使用file_exists,但不適用於我的smarty版本。 請建議我如何檢查圖像是否存在於給定的路徑?
你可以嘗試這樣的事情:
{assign var="image_name" value=$article.item_manufacturer|lower} {assign var="image" value="/home/sunflyer/public_html/media/manufacturer/$image_name.gif"} {if file_exists($image)}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.