我需要一个帮助。我需要在使用PHP从图像标记内的DB中取出之后设置图像路径。我正在解释下面的代码。
$getcustomerobj = $dbobj->getNewsData($id);
div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-left">Upload Image :</span>
<input type="file" class="filestyle form-control" data-size="lg" name="newsimage" id="newsimage" onChange="javascript:addImage(event,'img','disImage');">
</div>
<div id="disImage" style="display:none;">
<div class="input-group bmargindiv1 text-right col-md-12" >
<img src="uploads/"'.<?php echo $getcustomerobj->image ?>.' name="pro" id="img" border="0" style="width:50px; height:50px; border:#808080 1px solid;" />
</div>
我在这里使用$getcustomerobj
从数据库获取数据但无法显示它。请帮助我。
答案 0 :(得分:1)
你做错了。路径应该在"
s内。试试 -
<img src="uploads/<?php echo $getcustomerobj->image ?>" name="pro"...
会起作用。
答案 1 :(得分:0)
您的代码<img src="uploads/"'.<?php echo $getcustomerobj->image ?>.' name="pro" id="img" border="0" style="width:50px; height:50px; border:#808080 1px solid;" />
更改为
<img src="<?php echo 'uploads/'.$getcustomerobj->image ?>" name="pro" id="img" border="0" style="width:50px; height:50px; border:#808080 1px solid;" />