php8.5
Home/ Manual/ xmlwriter / xmlwriter/ XMLWriter::openUri

XMLWriter::openUri

PHP function Edit on GitHub ✎

(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)

Create new xmlwriter using source uri for output

Description

Oop

XMLWriter::openUri(string $uri): bool

Procedural

xmlwriter_open_uri(string $uri): XMLWriter|false

Creates a new XMLWriter using uri for the output.

Parameters

uri

The URI of the resource for the output.

Return Values

Oop: Success

Procedural: Returns a new XMLWriter instance for later use with the xmlwriter functions on success, Falseforfailure.

Changelog

VersionDescription
8.0.0This function returns now an XMLWriter instance on success. Previously, a Resource has been returned in this case.

Examples

Direct output of XML

It is possible to directly output XML by using the php://output stream wrapper.

php
<?php
$out =new XMLWriter();
$out->openURI('php://output');
?>

Notes

Note

On Windows, files opened with this function are locked until the writer is released.

See Also

  • XMLWriter::openMemory

Source: reference/xmlwriter/xmlwriter/openuri.xml · from the official PHP manual (php/doc-en)