PHP dns_get_record()ฟังก์ชัน
ตัวอย่าง
รับระเบียนทรัพยากร MX ที่เชื่อมโยงกับ "www.w3schools.com":
<?php
print_r(dns_get_record("w3schools.com", DNS_MX));
?>
ความหมายและการใช้งาน
ฟังก์ชัน dns_get_record() รับระเบียนทรัพยากร DNS ที่เกี่ยวข้องกับชื่อโฮสต์ที่ระบุ
ไวยากรณ์
dns_get_record(hostname, type, authns, addtl, raw)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
hostname | Required. Specifies a hostname (like "www.w3schools.com") |
type | Optional. Specifies the resource record type to search for. Can be one of the following:
|
authns | Optional. Passed by reference and, if set, it will be populated with Resource Records for the Authoritative Name Servers |
addtl | Optional. Passed by reference and, if set, it will be populated with any Additional Records |
raw | Optional. A Boolean value. If set to TRUE, it queries only the requested type instead of looping type-by-type before getting the info stuff. Default is FALSE |
รายละเอียดทางเทคนิค
คืนมูลค่า: |
อาร์เรย์ของ associative arrays, FALSE เมื่อล้มเหลว แต่ละอาร์เรย์มีคีย์ต่อไปนี้ (อย่างน้อย):
คีย์อื่นๆ ในอาร์เรย์จะขึ้นอยู่กับพารามิเตอร์ประเภท |
---|---|
รุ่น PHP: | 5.0+ |
บันทึกการเปลี่ยนแปลง PHP: | PHP 7.0.16: เพิ่มการรองรับสำหรับประเภท DNS_CAA PHP 5.4: เพิ่ม พารามิเตอร์ดิบ PHP 5.3: พร้อมใช้งานบนแพลตฟอร์ม Windows |
❮ การอ้างอิงเครือข่าย PHP