如题
domelement object( [tagname] => div [schematypeinfo] => [nodename] => div [nodevalue] => article name contents of article one two three four five [nodetype] => 1 [parentnode] => (object value omitted) [childnodes] => (object value omitted) [firstchild] => (object value omitted) [lastchild] => (object value omitted) [previoussibling] => [attributes] => (object value omitted) [ownerdocument] => (object value omitted) [namespaceuri] => [prefix] => [localname] => div [baseuri] => [textcontent] => article name contents of article one two three four five)
用textcontent获取的都是不带标签的内容...不知有木有php自带方法可以实现的?
回复内容: 如题
domelement object( [tagname] => div [schematypeinfo] => [nodename] => div [nodevalue] => article name contents of article one two three four five [nodetype] => 1 [parentnode] => (object value omitted) [childnodes] => (object value omitted) [firstchild] => (object value omitted) [lastchild] => (object value omitted) [previoussibling] => [attributes] => (object value omitted) [ownerdocument] => (object value omitted) [namespaceuri] => [prefix] => [localname] => div [baseuri] => [textcontent] => article name contents of article one two three four five)
用textcontent获取的都是不带标签的内容...不知有木有php自带方法可以实现的?
这个能返回带标签的内容,应该是你要找的吧?:http://cn2.php.net/manual/zh/domdocument.savehtml.php
如果是xml的话最好用savexml。