鍍金池/ 問答/PHP  Android  數(shù)據(jù)庫  HTML/ wordpress 的 xml 如何無縫接軌匯入 mysql ?

wordpress 的 xml 如何無縫接軌匯入 mysql ?

wordpress 的 xml 如何進(jìn)入 mysql 數(shù)據(jù)庫?

<rss version="2.0"
    xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:wp="http://wordpress.org/export/1.2/"
>    
<item>
<channel>
    <title>cako 每家都超厲害,快找到你心中的NO.1</title>
    <link>http://123123.123/13335</link>
    <pubDate>Wed, 10 Jan 2018 03:01:21 +0000</pubDate>
    <dc:creator><![CDATA[Ruby]]></dc:creator>
    <guid isPermaLink="false">http://123123.123/?p=13335</guid>
    <description></description>
    <content:encoded>

類似這種格式,我還真不知道怎麼丟到數(shù)據(jù)庫裡面?
是有套件可以使用嗎?
希望大神指教!

回答
編輯回答
青黛色

可以將xml當(dāng)成字符串存到mysql中。 使用時(shí)可以用mysql提供的專門處理xml的方法ExtractValue() 抽取xml中的內(nèi)容,或者使用UpdateXML()更新xml,兩個(gè)方法可以在官方文檔查閱

2017年4月25日 03:42
編輯回答
尋仙

用這個(gè)方法,先把xml轉(zhuǎn)成對(duì)象,然后在通過對(duì)象加入數(shù)據(jù)庫。

PHP: simplexml_load_string - Manual - http://www.php.net/manual/zh/...
2018年8月23日 23:41