RSS is a combination of webpage content and XML. All RSS documents comply with the XML1.0 standard. RSS is a combination of webpage content and XML. All RSS documents comply with the XML1.0 standard.
Example:
Title
Link address
Description
Description Language
Version
Time
Log title
Log urlLog author
Log release time
Log content
At this time, you should link to the database and output the desired results.
Test. PHP
Dom = new domDocument ('1. 0', 'utf-8'); $ this-> dom-> load ($ this-> template ); $ this-> rss = $ this-> dom-> GetElementsByTagName ('RSS ');} public functioncreateChannel () {$ channel = $ this-> dom-> createElement ("channel"); $ channel-> appendChild ($ this-> createEle ('title ', $ this-> title); $ channel-> appendChild ($ this-> createEle ('link', $ this-> link )); $ channel-> appendChild ($ this-> createEle ('Description', $ this-> description); $ this-> rss-> appendChild ($ channel );} public functioncreateEle ($ name, $ value) {$ element = $ this-> dom-> createElement ($ name ); $ text = $ this-> dom-> createTextNode ($ value); $ element-> appendChild ($ text); return $ element;} protected functionadditem ($ list) {foreach ($ listas $ goods) {$ this-> rss-> appendChild ($ this-> createitem ($ goods);} public functioncreateitem ($ arr) {$ item = $ this-> dom-> createElement ("item"); foreach ($ arras $ key => $ value) {$ item-> appendChild ($ this-> createEle ($ key, $ value);} return $ item;} public functiondisplay () {$ this-> createChannel (); $ this-> additem ($ this-> items); echo $ this-> dom-> savexml () ;}$ SQL = "select * fromstu "; $ rs = mysql_query ($ SQL); while ($ row = mysql_fetch_assoc ($ rs) {$ list [] = $ row;} $ test = new test (); $ test-> title = "test title"; $ test-> link = "test connection"; $ test-> description = "test content "; $ test-> display (); $ test-> items = $ list;
The above is the details of rss subscription using xml. For more information, see other related articles in the first PHP community!