XML Extra content at the end of the document

后端 未结 2 660
深忆病人
深忆病人 2020-12-12 06:09

I\'m getting this error:

error on line 4 at column 1: Extra content at the end of the document

with this code:

    $this-&g         


        
2条回答
  •  Happy的楠姐
    2020-12-12 06:53

    Without seeing the text output itself, it would be impossible to know for sure, but there are a couple of things I noticed immediately:

    1. To debug this, send the header header("Content-type: text");.
    2. parseToXML is an attempt to re-invent the wheel, use htmlentities.
    3. (This and the following should be irrelevant, you should be using htmlentities) You are replacing & after replacing everything else with an entity. This means you're getting, &lt; instead of <.
    4. str_replace takes arrays as parameters, you would be best using them.

提交回复
热议问题