What are the functions of the simplexml_load_string parameters of php?

Source: Internet
Author: User
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_stringThe first parameter received isstringTypexmlData,

  • 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.cdataData

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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.