菜鳥網絡開發人員在這里。我正在嘗試通過單擊從 url 下載圖像。但是當我使用圖像 url 作為我的 href 時,它只是重定向到該 url 而不是下載。當然我使用的是下載屬性。我已經嘗試過自己的代碼,也嘗試過其他人的多個代碼塊。但他們都只是重定向。我正在使用谷歌瀏覽器。我的代碼:<a href = "https://autoooo.nl/wp-content/uploads/2018/12/F5144B9C-2B27-4070-828E-2361EBD702EF-400x400.jpeg" download="car" id="downloadQRCodeButtonHref"> <p>download</p></a>我從別人那里使用的代碼1(接受的答案):<a download="custom-filename.jpg" href="/path/to/image" title="ImageName"> <img alt="ImageName" src="/path/to/image"></a>我從別人那里使用的代碼2: <p> Click the image ! You can download! </p><?php$image = basename("http://localhost/sc/img/logo.png"); // you can here put the image path dynamically //echo $image;?><a download="<?php echo $image; ?>" href="http://localhost/sc/img/logo.png" title="Logo title"> <img alt="logo" src="http://localhost/sc/img/logo.png"></a>一些幫助將不勝感激。我可能只是一個大笨蛋,忽略了一些非常明顯的東西。
添加回答
舉報
0/150
提交
取消