img src将不适用于php变量 [英] img src won't work with php variables

查看:54
本文介绍了img src将不适用于php变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<a href="'.$productLink.'" alt="'.$productName.'">
<img src="'.$productImg1URL.'" alt="'.$productName.' '.$productType.' ">
</a>

您好img src实际上位于其他目录/images

Hello the img src is actually in a different directory /images

我知道这可能超级简单,但我花了一个小时才完成,什么也没做.该页面有效,但不显示目录.请帮助菜鸟.我取出了<在href和img src前面无法显示页面

I know this is probably super easy but Ive spent an hour on it and nothing. The page works but doesn't show the directory. Please help the rookie. I took out the < in front of the a href and img src couldn't make the page display

推荐答案

作业#1当您对生成HTML的代码有疑问时,请查看输出源并将其与您的期望进行比较.我以前遇到过这样的问题,当我停止考虑PHP代码并查看实际输出时,它们通常消失了.

Job #1 when you have a problem with code that is generating HTML, is look at the output source and compare it with what you expect. I've had problems like this before and they usually vanished when I stopped thinking about the PHP code, and looked at the actual output.

$ productImg1URL的内容是什么-如果它所引用的图像在以/images/开头的URL中-会以$ productImg1URL开头.如果只是图像的名称,但没有路径,则必须将其放置到位.

What is the content of $productImg1URL - and if the images that it's referencing are in the URL starting /images/ - does that start $productImg1URL. If it's just the name of an image, but without the path - you have to put that into place.

这篇关于img src将不适用于php变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆