PHP Concatenating of image link in echo

独自空忆成欢 提交于 2019-12-12 01:56:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!