主頁 > 知識庫 > PHP _construct()函數(shù)講解

PHP _construct()函數(shù)講解

熱門標簽:電子圍欄 Mysql連接數(shù)設(shè)置 科大訊飛語音識別系統(tǒng) 銀行業(yè)務(wù) 團購網(wǎng)站 Linux服務(wù)器 服務(wù)器配置 阿里云

PHP _construct() 函數(shù)

實例

函數(shù)創(chuàng)建一個新的 SimpleXMLElement 對象,然后輸出 body 節(jié)點的內(nèi)容:

?php 
$note=XML
note> 
to>Tove/to> 
from>Jani/from> 
heading>Reminder/heading> 
body>Don't forget me this weekend!/body> 
/note> 
XML; 
$xml=new SimpleXMLElement($note); 
echo $xml->body; 
?>

[運行實例»](/try/showphp.php?filename=demo_func_simplexml_construct)

定義和用法

_construct() 函數(shù)創(chuàng)建一個新的 SimpleXMLElement 對象。

語法

_construct( _data,options,data_is_url,ns,is_prefix_ );

假設(shè)我們有如下的 XML 文件,"note.xml":

?xml version="1.0" encoding="ISO-8859-1"?> 
note> 
to>Tove/to> 
from>Jani/from> 
heading>Reminder/heading> 
body>Don't forget me this weekend!/body> 
/note>

實例 1

從 URL 中創(chuàng)建一個 SimpleXMLElement 對象:

?php 
$xml=new SimpleXMLElement("note.xml",NULL,TRUE); 
echo $xml->asXML(); 
?>

總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請查看下面相關(guān)鏈接

您可能感興趣的文章:
  • PHP count()函數(shù)講解
  • PHP getDocNamespaces()函數(shù)講解
  • PHP getName()函數(shù)講解
  • PHP getNamespaces()函數(shù)講解
  • PHP registerXPathNamespace()函數(shù)講解
  • PHP children()函數(shù)講解
  • PHP attributes()函數(shù)講解
  • PHP asXML()函數(shù)講解
  • PHP addAttribute()函數(shù)講解
  • PHP simplexml_import_dom()函數(shù)講解

標簽:大理 蚌埠 衡水 衢州 江蘇 廣元 棗莊 萍鄉(xiāng)

巨人網(wǎng)絡(luò)通訊聲明:本文標題《PHP _construct()函數(shù)講解》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266