[英]Print Image Based on Pre-Defined Variable
我對PHP相當陌生,我想知道如何編寫這樣的代碼,對不起,我無法弄清楚我最終可能如何找到相關答案的搜索字詞
具體來說,這將通過使用總計來檢查購物車是否為空
if PHP $var = 0
then $printsrc='http://localhost/images/image1.jpg'
elseif $var > 0
then $printsrc='http://localhost/images/image2.jpg'
然后在圖像標簽中更改圖像,例如
<img src="<php $printsrc ?>" id="hello">
您需要這樣設置->
<img src="<php $printsrc ?>" id="hello">
至
<img src="<?php echo $printsrc ?>" id="hello">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.