PHP holds XML files: Reading and displaying

Source: Internet
Author: User
In this example, the PHP file reads and displays the content of the xml file. Which of the following is the content of the PHP file? just put the php file and slashdot. xml in the same folder? Php $ open_tags = array ('story' = 'story', 'title' = 'title', 'URL' = 'URL', 'author' = 'au In this example, the PHP file reads and displays the xml file content.

The content of the PHP file is as follows. put the php file and slashdot. xml in the same folder.

$ Open_tags= Array (
'Story'=>' ' ,
'Title'=>''</SPAN> <SPAN style = 'color: #007700'>, <BR> </SPAN> <SPAN style = 'color: # dd0000 '> 'URL' </SPAN> <SPAN style = 'color: #007700' >=> </SPAN> <SPAN style = 'color: # dd0000 '>' <URL> '</SPAN> <SPAN style = 'color: #007700'>, <BR> </SPAN> <SPAN style = 'color: # dd0000 '> 'author' </SPAN> <SPAN style = 'color: #007700' >=> </SPAN> <SPAN style = 'color: # dd0000 '> ''<BR> </SPAN> <SPAN style = 'color: #007700'>); <BR> </SPAN> <SPAN style = 'color: # 0000bb '> $ close_tags </SPAN> <SPAN style = 'color: #007700'> = array (<BR> </SPAN> <SPAN style = 'color: # dd0000 '> 'store' </SPAN> <SPAN style = 'color: #007700' >=> </SPAN> <SPAN style = 'color: # dd0000 '>' </STORY> '</SPAN> <SPAN style = 'color: #007700'>, <BR> </SPAN> <SPAN style = 'color: # dd0000 '> 'title' </SPAN> <SPAN style = 'color: #007700' >=> </SPAN> <SPAN style = 'color: # dd0000'>'',
'URL'=>'',
'Author'=>''
);
?>

// The following is the definition function to extract data:

// Process start tag attributes
// $ Attrs is an *** array. The key value is the attribute name and the value is the attribute value.
FunctionStartElement($ Parser,$ Name,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.