10

我拿过这个系统,但它不知道发生了什么!

行:197 core.php

foreach ($this->getAll() as $banner) { 

行:191 core.php

$_xmlBanners = simplexml_load_file(PATH_XML."banners.xml");

我的xml:

<?xml version="1.0" encoding="UTF-8"?>
<list>
    <banner id="1">
        <image>http://lineagefree.com/acp/images/l2jbr.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='list_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
    <banner id="2">
        <image>http://lineagefree.com/acp/images/top100mmorpg.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
    <banner id="3">
        <image>http://lineagefree.com/acp/images/gamesitestop100.jpg</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        <banner id="4">
        <image>http://lineagefree.com/acp/images/arenatop100.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        <banner id="5">
        <image>http://lineagefree.com/acp/images/mmorpglist.jpg</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        <banner id="6">
        <image>http://lineagefree.com/acp/images/top200.gif</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
</list>

我的错误重新出现:

[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: /home/lineage/public_html/acp/xml/banners.xml:48: parser error : Opening and ending tag mismatch: banner line 33 and list in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: &lt;/list&gt; in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]:        ^ in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: /home/lineage/public_html/acp/xml/banners.xml:48: parser error : Premature end of data in tag banner line 26 in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: &lt;/list&gt; in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]:        ^ in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: /home/lineage/public_html/acp/xml/banners.xml:48: parser error : Premature end of data in tag banner line 19 in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: &lt;/list&gt; in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]:        ^ in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: /home/lineage/public_html/acp/xml/banners.xml:48: parser error : Premature end of data in tag list line 2 in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: &lt;/list&gt; in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]:        ^ in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Notice:  Trying to get property of non-object in /home/lineage/public_html/acp/core.php on line 206
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  Invalid argument supplied for foreach() in /home/lineage/public_html/acp/core.php on line 197

我有这个问题。听说过字符编码。某物。但我该如何解决?遵循所有数据。如果您需要更多,请问我。我很绝望。对不起我的英语。用谷歌完成!谢谢你

4

3 回答 3

14

您缺少一堆结束标签。在浏览器中加载文件,它会告诉你行号。

下面您将看到固定的 xml:

<?xml version="1.0" encoding="UTF-8"?>
<list>
    <banner id="1">
        <image>http://lineagefree.com/acp/images/l2jbr.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='list_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
    <banner id="2">
        <image>http://lineagefree.com/acp/images/top100mmorpg.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
    <banner id="3">
        <image>http://lineagefree.com/acp/images/gamesitestop100.jpg</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        </banner>
        <banner id="4">
        <image>http://lineagefree.com/acp/images/arenatop100.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        </banner>
        <banner id="5">
        <image>http://lineagefree.com/acp/images/mmorpglist.jpg</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        </banner>
        <banner id="6">
        <image>http://lineagefree.com/acp/images/top200.gif</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
  </list>
于 2013-08-23T19:06:06.427 回答
0

你的 <banner id="3">没有结束标签。<banner id="4"><banner id="5">标签也不行。

如果您在</banner>其中添加结束标签,您的 xml 将是有效的

于 2013-08-23T19:04:29.090 回答
0

id 为 3、4 和 5 的横幅元素未关闭。请检查您的 XML。您应该关闭所有标签。

于 2013-08-23T19:05:00.670 回答