PHP 8.5.0 Beta 3 available for testing

DOMComment::__construct

(PHP 5, PHP 7, PHP 8)

DOMComment::__construct โ€” ๆ–ฐใ—ใ„ DOMComment ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใ‚’ไฝœๆˆใ™ใ‚‹

่ชฌๆ˜Ž

public DOMComment::__construct(string $data = "")

ๆ–ฐใ—ใ„ DOMComment ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใ‚’ไฝœๆˆใ—ใพใ™ใ€‚ ใ“ใฎใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใฏ่ชญใฟ่พผใฟๅฐ‚็”จใงใ™ใ€‚ใ“ใฎใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใ‚’ใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆใซ ่ฟฝๅŠ ใ™ใ‚‹ใ“ใจใŒๅฏ่ƒฝใงใ™ใŒใ€ใƒŽใƒผใƒ‰ใŒใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆใจ้–ข้€ฃไป˜ใ‘ใ‚‰ใ‚Œใ‚‹ใพใงใฏ ใƒŽใƒผใƒ‰ใ‚’่ฟฝๅŠ ใ™ใ‚‹ใ“ใจใฏใงใใพใ›ใ‚“ใ€‚ๆ›ธใ่พผใฟๅฏ่ƒฝใชใƒŽใƒผใƒ‰ใ‚’ไฝœๆˆใ™ใ‚‹ใซใฏใ€ DOMDocument::createComment ใ‚’ไฝฟ็”จใ—ใพใ™ใ€‚

ใƒ‘ใƒฉใƒกใƒผใ‚ฟ

data

ใ‚ณใƒกใƒณใƒˆใฎๅ€คใ€‚

ไพ‹

ไพ‹1 ๆ–ฐใ—ใ„ DOMComment ใ‚’ไฝœๆˆใ™ใ‚‹

<?php

$dom
= new DOMDocument('1.0', 'iso-8859-1');
$element = $dom->appendChild(new DOMElement('root'));
$comment = $element->appendChild(new DOMComment('root comment'));
echo
$dom->saveXML(); /* <?xml version="1.0" encoding="iso-8859-1"?><root><!--root comment--></root> */

?>

ๅ‚่€ƒ

๏ผ‹add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top