问题
I want to echo the image such that the variables $CatSelected will be the folder of the images and $char and $i are part of the img names : e.g
echo "<img src =\"Images/product/".$CatSelected."/".$char$i."s0.jpg"\>";
回答1:
echo "<img src =\"Images/product/".$CatSelected."/".$char.$i."s0.jpg\"\>";
^ ^
1) You forgot to concatenate $char and $i.
2) You forgot to escape the double quotes.
回答2:
try this
echo "<img src ='Images/product/'".$CatSelected."/".$char$i."'s0.jpg'\>";
来源:https://stackoverflow.com/questions/17340959/php-concatenating-of-image-link-in-echo