Home >Backend Development >PHP Tutorial >'Flex+PHP RIA Application Development Practical Detailed Explanation-Liang Wen New Edition' Learning Diary 2

'Flex+PHP RIA Application Development Practical Detailed Explanation-Liang Wen New Edition' Learning Diary 2

WBOY
WBOYOriginal
2016-07-29 08:51:09974browse

This book is really torture. I saw the XML parsing part today. The article was very careful in introducing the functions and their parameters. However, this book did not write the source code clearly. There is always a missing part. XML and PHP are not very case sensitive. I'm sensitive and can read it all. I also encountered a garbled code problem today. I hope that a master in this field can see it and help solve it. Thank you very much! The code in the book is posted below:

function start($parser,$element_name,$element_attrs)
{
switch($element_name)
{
case "Book":
echo " ----Book introduction----
"; //The content of this paragraph is not displayed either
break;
case "TITLE":
echo "Book name:";
break ;
case "AUTHOR":
echo "Author:";
break;
case "ISBN":
echo "ISBN:";
break;
case "DATA":
echo "Publication date:";
break;
case "PRICE":
echo "Book price:";
break;
}
}
function stop($parser,$element_name)
{
echo "
";
}
function char( $parser,$data)
{
echo $data;
}
$parser=xml_parser_create();
xml_set_element_handler($parser,"start","stop");
xml_set_character_data_handler($parser,"char");
$fp=fopen("Book.xml","r");
while($data=fread($fp,4096))
{
xml_parse($parser,$data,feof($fp)) or
die (sprintf("XML Error: %s at line %d",
xml_error_string(xml_get_error_code($parser)),
xml_get_current_line_number($parser)));
}
xml_parser_free($parser);
?>
Book. The xml code is as follows:





The essence of JavaScript
Crockford,D
9787121177408
2012.9< /DATA>
49.00 yuan


《Flex+PHP RIA应用开发实战详解-梁文新版》学习日记2

The above introduces the "Flex+PHP RIA Application Development Practical Detailed Explanation - Liang Wen New Edition" learning diary 2, including the content, I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn