Working with the OO API

Working with the OO API

This example shows how to work with XMLWriter's object-oriented API.

示例 #1 Working with the OO 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>

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *