What is the difference between this and $ xmlsimplexml_load_string ($ string?
This and this write
$ Xml = simplexml_load_string ($ string) What is the difference?
Reply content:
This and this write
$ Xml = simplexml_load_string ($ string) What is the difference?
simplexml_load_string
The first parameter received isstring
Typexml
Data,
The second parameter is the object type returned by the method. the default value isSimpleXMLElement
, You can customize, but the class must inherit fromSimpleXMLElement
,
The third parameter is some operation options. For more information, see merge.cdata
Data
First, let's take a look at the meanings of the two parameters after simplexml_load_string.
Here: http://php.net/manual/zh/func...
The second parameter: specifies the returned object of a class. If this parameter is not set, the default value is the object of the SimpleXMLElement class.
Here: http://php.net/manual/zh/clas...
Third parameter: pass in some predefined constants to control some of the control when the object returns
Here: http://php.net/manual/zh/libx...
Therefore, the second parameter here is that the default returned object is no different from the one you only set. The key is that the third parameter is set to control if the XML node contains 小牛N1 The goods_name value is not in the object. if LIBXML_NOCDATA is added, the value is N1, which is equivalent小牛N1Convert to text return
The second parameter indicates the class used for parsing. the class must inherit from SimpleXMLElement, and the default value is SimpleXMLElement.
The third parameter indicates the resolution option. LIBXML_NOCDATA indicates that CDATA is not converted. Instead, it is parsed as common text.
These items are available in the document. you can come here to ask, in the words of laruence, you have found the slowest way to get knowledge.
Http://php.net/manual/en/func...