-1
我想将我在数据库中创建的图像引用用作背景:url。我已经完成了设计=>http://i49.tinypic.com/30ihudz.png在我当前的代码中,我使用div样式来检索图像,但没有显示图像。有人请指导我吗?提前致谢。从后台数据库中检索图像名称:url
公共函数displayProduct() {
$product = $this->db->query("SELECT id, title, description, price, filename FROM trips ORDER BY id");
while ($row = $product->fetch_assoc())
{
$output .= '<div class="reisbox">';
$output .= '<div id="reis_insidebox1" style="background: url(\'img/content/'.$row['filename'].'\')" width="1000" height="500">';
$output .= '<div class="reis_textbox">';
$output .= '<h2>'.ucfirst($row['title']).'</h2>';
$output .= '<article>';
$output .= ucfirst($row['description']);
$output .= '</article>';
$output .= '</div>';
$output .= '<div class="rightboxx">';
$output .= '<div class="reis_price_box">';
$output .= '<div class="reis_price_box_text">';
$output .= '€'.$row['price'];
$output .= '</div>';
$output .= '<div class="more_box">';
$output .= '<a href="index.php?page=reis.php&pid='.$row['id'].'"><p>Lees meer..</p></a>';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
$output .='<br />';
$output .= '<div id="add">';
$output .='<a href="index.php?page=cart.php&action=add&id='.$row['id'].'"><p>Add to cart</p></a>';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
}
return $output;
}
谢谢,我编辑过,但问题仍未解决 – user2031928 2013-02-24 15:20:00
当您查看页面源代码时,是否在代码中看到正确的URL?如果是这样,请将其剪下并直接将URL粘贴到浏览器的地址栏中。如果这不显示图像,您的浏览器无法访问该文件。 – 2013-02-24 17:05:55
我修好了,我修改了代码 – user2031928 2013-02-24 17:17:54