我开始在Steam API的前面搞乱了,并且我使用GetPlayerSummaries方法创建了一个显示配置文件信息的简单站点。它一直致力于伟大的,正确的,直到我的一些朋友开始加入iOS的表情在他们的名字,这会导致如下:PHP file_get_contents超出最大执行时间(表情的原因?)
致命错误:超过300秒最长执行时间文件上线137
这是针对该文件在该行:
public function getPlayerSummary($steamid) {
$contents = file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=".SteamAPI_APIKey."&steamids=".$steamid);
$json = json_decode($contents, true);
foreach($json['response']['players'] as $key => $value) {
...
}
}
(这是一个函数,$汽调用函数)
这应返回(JSON)当ID定义:
{
"response": {
"players": [
{
"steamid": "_removed_",
"communityvisibilitystate": 3,
"profilestate": 1,
"personaname": "_removed_ ",
"lastlogoff": 1426734965,
"profileurl": "http://steamcommunity.com/id/_removed_/",
"avatar": "_removed_",
"avatarmedium": "_removed_",
"avatarfull": "_removed_",
"personastate": 0,
"realname": "_removed_",
"primaryclanid": "_removed_",
"timecreated": 1349251405,
"personastateflags": 0,
"loccountrycode": "DE"
}
]
}
}
但是 “” 在personaname打乱它,因为它适用于所有的人,而不它:/这是一个幽灵表情,和另一个朋友在他的名字中使用猴子表情一样。
有没有人有任何想法我可以解决这个问题?
请张贴更多的代码,我不认为'file_get_contents'导致这(PHP是不是报告错误非常好),我的猜测是'json_decode'不能分析奇怪的字符,你可以[在内容中不替换utf-8字符](http://stackoverflow.com/questions/1401317/remove-non-utf8-characters-from-字符串),然后是'json_decode'字符串 – 2015-03-19 08:30:10
增加了一点点,虽然除了函数中的'file_get_contents'仍然导致它:/ – Mitch 2015-03-19 08:48:19
如果您尝试通过char读取文件char,会发生什么? http://pastebin.com/Qr7RxvHW – 2015-03-19 09:06:58