如果没有图像,则禁用下载

时间:2017-01-09 11:46:48

标签: javascript php ajax hyperlink download

HTML部分在下面给出

<a download="<?php echo $value['product_name']; ?>" href="Image/<?php echo $value['product_image']; ?>" title="<?php echo $value['product_name']; ?>" style = "cursor: not-allowed" class="download" disabled="disabled"> Download</a>

如果数据库中没有图像,如何阻止用户下载图像?

1 个答案:

答案 0 :(得分:0)

if声明中:

<?php if ($value['product_image']){?>

<a download="<?php echo $value['product_name']; ?>" href="Image/<?php echo $value['product_image']; ?>" title="<?php echo $value['product_name']; ?>" style = "cursor: not-allowed" class="download" disabled="disabled"> Download</a>

{?php } ?>