DOMProcessingInstruction->__construct()とは? わかりやすく解説

Weblio 辞書 > コンピュータ > PHP関数リファレンス > DOMProcessingInstruction->__construct()の意味・解説 

DOMProcessingInstruction->__construct()

(PHP 5)
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()



このページでは「PHP関数リファレンス」からDOMProcessingInstruction->__construct()を検索した結果を表示しています。
Weblioに収録されているすべての辞書からDOMProcessingInstruction->__construct()を検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDOMProcessingInstruction->__construct() を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DOMProcessingInstruction->__construct()」の関連用語

DOMProcessingInstruction->__construct()のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DOMProcessingInstruction->__construct()のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2025 by the PHP Documentation Group.

©2025 GRAS Group, Inc.RSS