Dom\CharacterData::remove

(PHP 8 >= 8.4.0)

Dom\CharacterData::remove โ€” CDATAใƒŽใƒผใƒ‰ใ‚’ๅ‰Š้™คใ™ใ‚‹

่ชฌๆ˜Ž

public function Dom\CharacterData::remove(): void

CDATA ใƒŽใƒผใƒ‰ใ‚’ๅ‰Š้™คใ—ใพใ™ใ€‚

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

ใ“ใฎ้–ขๆ•ฐใซใฏใƒ‘ใƒฉใƒกใƒผใ‚ฟใฏใ‚ใ‚Šใพใ›ใ‚“ใ€‚

ๆˆปใ‚Šๅ€ค

ๅ€คใ‚’่ฟ”ใ—ใพใ›ใ‚“ใ€‚

ไพ‹

ไพ‹1 Dom\CharacterData::remove() ใฎไพ‹

ๆ–‡ๅญ—ใƒ‡ใƒผใ‚ฟใ‚’ๅ‰Š้™คใ—ใพใ™ใ€‚

<?php
$doc
= Dom\XMLDocument::createFromString("<container><![CDATA[hello]]><world/></container>");
$cdata = $doc->documentElement->firstChild;

$cdata->remove();

echo
$doc->saveXML();
?>

ไธŠใฎไพ‹ใฎๅ‡บๅŠ›ใฏไปฅไธ‹ใจใชใ‚Šใพใ™ใ€‚

<?xml version="1.0"?>
<container><world/></container>

ๅ‚่€ƒ

  • Dom\ChildNode::remove() - ใƒŽใƒผใƒ‰ใ‚’ๅ‰Š้™คใ™ใ‚‹
  • Dom\CharacterData::after() - ๆ–‡ๅญ—ใƒ‡ใƒผใ‚ฟใฎๅพŒใ‚ใซใƒŽใƒผใƒ‰ใ‚’่ฟฝๅŠ ใ™ใ‚‹
  • Dom\CharacterData::before() - ๆ–‡ๅญ—ใƒ‡ใƒผใ‚ฟใฎๅ‰ใซใƒŽใƒผใƒ‰ใ‚’่ฟฝๅŠ ใ™ใ‚‹
  • Dom\CharacterData::replaceWith() - ๆ–‡ๅญ—ใƒ‡ใƒผใ‚ฟใ‚’ๆ–ฐใ—ใ„ใƒŽใƒผใƒ‰ใง็ฝฎใๆ›ใˆใ‚‹
  • Dom\Node::removeChild()
๏ผ‹add a note

User Contributed Notes

There are no user contributed notes for this page.