DOMProcessingInstruction->__construct()
DOMProcessingInstruction->__construct() — 新しい DOMProcessingInstruction オブジェクトを作成する
説明
class DOMProcessingInstruction {__construct ( string name [, string value] )
} 新しい
DOMProcessingInstruction
オブジェクトを
作成します。このオブジェクトは読み込み専用です。このオブジェクトを
ドキュメントに追加することは可能ですが、ノードをドキュメントに
関連付けるまではこのノードに別のノードを追加することはできません。
書き込み可能なノードを作成するには、
DOMDocument->createProcessingInstruction()
を使用してください。
パラメータ
- name
-
処理命令のタグ名。
- value
-
処理命令の値。
例
例 512. 新しい DOMProcessingInstruction を作成する
<?php
$dom = new DOMDocument('1.0', 'UTF-8');
$html = $dom->appendChild(new DOMElement('html'));
$body = $html->appendChild(new DOMElement('body'));
$pinode = new DOMProcessingInstruction('php', 'echo "Hello World"; ');
$body->appendChild($pinode);
echo $dom->saveXML();
?>
上の例の出力は以下となります。<?xml version="1.0" encoding="UTF-8" ?>
<html><body><?php echo "Hello World"; ?></body></html>
参考
DOMDocument->createProcessingInstruction() |
Weblioに収録されているすべての辞書からDOMProcessingInstruction->__construct()を検索する場合は、下記のリンクをクリックしてください。

- DOMProcessingInstruction->__construct()のページへのリンク