Devdit
 

โค้ด PHP button download file

0.9K

โค้ด PHP button download file บทความนี้สอนสร้าง button ด้วยแท็ก input type=button HTML พร้อมกำหนด onclick เมื่อผู้ใช้งานกดปุ่มให้ download file ด้วยภาษา PHP สามารถเขียนโปรแกรมได้ดังนี้

 

ตัวอย่าง โค้ด PHP button download file

<?php
  echo "<input type='button' value='download file' onclick=\"window.location='example.zip'\">";
?>

คำอธิบาย

โค้ด PHP button download file จากตัวอย่างสร้าง button ด้วยแท็ก input type='button' กำหนดข้อความบนปุ่มคือ ‘download file’ เมื่อกดคลิกจะเรียกใช้คำสั่งใน onclick ร่วมกับ window.location เพื่อ download file ตามลิงก์ที่กำหนดไว้

เขียน 1 ปีที่แล้ว
ชอบ
ลิ้งก์
แชร์
Devdit มีช่อง YouTube แล้ว
เราสร้างวิดีโอเกี่ยวกับเทคโนโลยี ทำตามง่ายๆ