PHP 8.1.28 Released!

オブジェクト指向 API の使用

この例では、XMLWriter のオブジェクト指向 API を使う方法を示します。

例1 オブジェクト指向 API の使用

<?php

$xw
= new XMLWriter();
$xw->openMemory();
$xw->startDocument("1.0");
$xw->startElement("book");
$xw->text("example");
$xw->endElement();
$xw->endDocument();
echo
$xw->outputMemory();

上の例の出力は以下となります。

<?xml version="1.0"?>
<book>example</book>

add a note

User Contributed Notes

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