oo_009.phpt
来自「PHP v6.0 For Linux 运行环境:Win9X/ WinME/ Wi」· PHPT 代码 · 共 46 行
PHPT
46 行
--TEST--XMLWriter: PI, Comment, CDATA--SKIPIF--<?php if (!extension_loaded("xmlwriter")) die("skip"); ?>--FILE--<?php /* $Id: OO_009.phpt,v 1.4 2006/07/19 18:58:06 pajoye Exp $ *//*Libxml 2.6.24 and up adds a new line after a processing instruction (PI)*/$xw = new XMLWriter();$xw->openMemory();$xw->setIndent(TRUE);$xw->startDocument("1.0", "UTF-8");$xw->startElement('root');$xw->writeAttribute('id', 'elem1');$xw->startElement('elem1');$xw->writeAttribute('attr1', 'first');$xw->writeComment('start PI');$xw->startElement('pi');$xw->writePi('php', 'echo "hello world"; ');$xw->endElement();$xw->startElement('cdata');$xw->startCdata();$xw->text('<>&"');$xw->endCdata();$xw->endElement();$xw->endElement();$xw->endElement();$xw->endDocument();// Force to write and empty the buffer$output = $xw->flush(true);print $output;?>--EXPECTF--<?xml version="1.0" encoding="UTF-8"?><root id="elem1"> <elem1 attr1="first"> <!--start PI--> <pi><?php echo "hello world"; ?>%w</pi> <cdata><![CDATA[<>&"]]></cdata> </elem1></root>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?