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;
}
警告: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
编辑1 : simplexml_load_string是我的错误之一,但现在我simplexml_load_file有更多的错误 - 告诉我文档是空的...(不是真的!
您正在加载 URL 作为 XML 源。您应该具备:
$profileData = simplexml_load_file($url);
url 从 steamcommunity.com/profiles/76561197991676121/?xml=1 更改为 http://steamcommunity.com/id/virusbogdan/?xml=1 。显然,第一个链接返回 null,因此出现了错误。 问题解决了!