Modern DOM library written in PHP for HTML documents
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

961 B

title
Document::save

Document::save — Serializes the DOM tree into a file

Description

public Document::save ( string $filename , null $options = null ) : int|false

Creates an HTML document from the DOM representation.

Parameters

filename
The path to the saved HTML document
options
Always null. Was used for option constants in \DOMDocument.

Return Values

Returns the number of bytes written or false on failure.

Examples

Example #1 Saving a DOM tree into a file

<?php

namespace MensBeam\HTML;

$dom = new Document();
$dom->loadHTML('<!DOCTYPE html><html><head><title>Ook!</title></head><body><h1>Eek</h1></body></html>');
echo 'Wrote: ' .  $dom->save('/tmp/test.html') . ' bytes'; // Wrote: 85 bytes

?>