SimpleXML 函数 业 ,精于勤 荒于嬉.

SimpleXML 函数 simplexml_import_dom Get a SimpleXMLElement object from a DOM node

发表日期:2021-07-01 08:57:25 | 来源: | 分类:SimpleXML 函数

      示例1
01<?php
02$dom new DOMDocument;
03$dom->loadXML('<books><book><title>blah</title></book></books>');
04if (!$dom) {
05    echo 'Error while parsing the document';
06    exit;
07}
08$s = simplexml_import_dom($dom);
09echo $s->book[0]->title;
10?>

阅读全文 »

SimpleXML 函数 simplexml_load_file Interprets an XML file into an object

发表日期:2021-07-01 08:57:25 | 来源: | 分类:SimpleXML 函数

      示例1
1<?php
2// The file test.xml contains an XML document with a root element// and at least an element /[root]/title.if (file_exists('test.xml')) {
3    $xml = simplexml_load_file('test.xml');
4     print_r($xml);
5}
6 else {
7    exit('Failed to open test.xml.');
8}
9?>

阅读全文 »

SimpleXML 函数 simplexml_load_string Interprets a string of XML into an object

发表日期:2021-07-01 08:57:25 | 来源: | 分类:SimpleXML 函数

      示例1
1<?php
2$string = <<<XML<?xml version='1.0'?> <document> <title>Forty What?</title> <from>Joe</from> <to>Jane</to> <body>  I know that's the answer -- but what's the question? </body></document>XML;
3$xml = simplexml_load_string($string);
4print_r($xml);
5?>

阅读全文 »

全部博文(1589)
集速网 copyRight © 2015-2022 宁ICP备15000399号-1 宁公网安备 64010402001209号
与其临渊羡鱼,不如退而结网
欢迎转载、分享、引用、推荐、收藏。