小编vir*_*dan的帖子

预期XML分析器错误开始标记

function retrieveProfile() 
{
    $url = "http://steamcommunity.com/profiles/{$this->steamID64}/?xml=1";
    $profileData = simplexml_load_string($url);

    if(!empty($profileData->error)) { return NULL; }

    $this->friendlyName  = (string) $profileData->steamID;  
}
Run Code Online (Sandbox Code Playgroud)

警告:simplexml_load_string()[function.simplexml-load-string]:实体:第1行:解析器错误:期望开始标记,未找到"<"

警告:simplexml_load_string()[function.simplexml-load-string]:http://steamcommunity.com/profiles/76561197991676121/?xml = 1

警告:simplexml_load_string()[function.simplexml-load-string]:^

这是XML文件:

http://steamcommunity.com/profiles/76561197991676121/?xml=1

我没有想到它为什么不起作用,是的它有<?xml version="1.0" encoding="UTF-8" standalone="yes"?>标题!尝试$profileData = new SimpleXMLElement(file_get_contents($url))过,但我得到了相同的结果.

为什么会这样?我该如何解决?我正在寻找3个小时,只看到对我没有帮助的答案.
错误:http://img824.imageshack.us/img824/9464/errorszz.png

EDIT1:simplexml_load_string是我的一个错误,但现在我使用simplexml_load_file得到更多错误 - 告诉我文档是空的......(不是这样!)

html php xml steam

4
推荐指数
1
解决办法
3万
查看次数

标签 统计

html ×1

php ×1

steam ×1

xml ×1