欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時間:2019年02月03日 09:26:49   作者:php參考手冊  
今天小編就為大家分享一篇關(guān)于PHP _construct()函數(shù)講解,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧

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)容對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,謝謝大家對腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請查看下面相關(guān)鏈接

相關(guān)文章

最新評論