PHP reading XML files

Source: Internet
Author: User
When PHP reads an XML file, it intercepts the following part: & nbsp; & lt ;? Php $ domnewDOMDocument; $ dom-& gt; load (& quot; Practice. xml & quot;); this line has an error & nbsp ;..... & nbsp ;..... & nbsp ;? & Gt; error message: & nbsp; an error occurred while reading the XML file in PHP.
CLIP:
$ Dom = new DOMDocument;
$ Dom-> load ("Practice. xml"); // This row has an error.
.....
.....
?>
Error message:
Warning: DOMDocument: load () [domdocument. load]: Input is not proper UTF-8,
Indicate encoding! Bytes :......

In the Practice. xml document, I used encoding = "UTF-8", but I still cannot see Chinese content. I don't know where the problem is?

------ Solution --------------------
Practice. xml also uses UTF-8 encoding
------ Solution --------------------
Practice. xml must be UTF-8 encoded during storage.
------ Solution --------------------
You do not need to save the php file as UTF-8
Instead, you need to save the xml file as UTF-8
Since the xml file has been declared

If the content is not UTF-8, an error is returned.

You can also modify the xml language declaration.

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.