DomElement->has_attribute()とは? わかりやすく解説

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

DomElement->has_attribute()

(No version information available, might be only in CVS)
DomElement->has_attribute() — 現在のノードに属性があるかどうかを調べる

説明

class DomElement {
bool has_attribute ( string name )
} この関数は、現在のノードに名前 name を持つ属性があるかどうかを調べます。

パラメータ

name
検査する属性名

返り値

もし問い合わせた属性が存在する場合 TRUE、そうでない場合 FALSE を返します。

例 531. 属性の存在を調べる
<?php

include("example.inc");

if (!$dom = domxml_open_mem($xmlstr)) {
   echo "Error while parsing the document\n";
   exit;
}

$root = $dom->document_element();

$buffer = '<html';
if ($root->has_attribute('language')) {
   $buffer .= 'lang="' . $root->get_attribute('language') . '"';
}
$buffer .= '>';

?>


PHP 5 への移行

DOMElement->hasAttribute() を使用してください。

DOMElement->hasAttribute()

(No version information available, might be only in CVS)
DOMElement->hasAttribute() — 属性が存在するかどうかを調べる

説明

class DOMElement {
bool hasAttribute ( string name )
} 要素のメンバとして name という名前の属性が 存在するかどうかを示します。

パラメータ

name
要素名。

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

参考

DOMElement->hasAttributeNS()
DOMElement->getAttribute()
DOMElement->setAttribute()
DOMElement->removeAttribute()




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

辞書ショートカット

すべての辞書の索引

「DomElement->has_attribute()」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS