Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/395.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 打开ID&从负载中止蒸汽_Javascript_Php_Jquery_Ajax - Fatal编程技术网

Javascript 打开ID&从负载中止蒸汽

Javascript 打开ID&从负载中止蒸汽,javascript,php,jquery,ajax,Javascript,Php,Jquery,Ajax,我有这个问题,因为我把蒸汽登录到一个网站。基本上,因为steam api有时需要大约40秒来加载数据,所以我在加载时创建了一个javascript函数,以加快页面加载速度。此函数在加载页面后加载,因此steam api在后台工作。但是,当用户离开/刷新页面时,此函数工作[代码1],新页面将等待上一个加载函数 PS:所有连接数据库,steamapi。。是由下面的connect.php制作的[代码3]。这个页面有两种加载方式:在用这种方式加载页面之前,使用php包含函数,我可以包含任何必需的文件,如

我有这个问题,因为我把蒸汽登录到一个网站。基本上,因为steam api有时需要大约40秒来加载数据,所以我在加载时创建了一个javascript函数,以加快页面加载速度。此函数在加载页面后加载,因此steam api在后台工作。但是,当用户离开/刷新页面时,此函数工作[代码1],新页面将等待上一个加载函数

PS:所有连接数据库,steamapi。。是由下面的connect.php制作的[代码3]。这个页面有两种加载方式:在用这种方式加载页面之前,使用php包含函数,我可以包含任何必需的文件,如数据库信息、数据库连接[Code4]。第二种方法是下面的javascript函数[Code2]

PS 2:当加载…仍然出现在版权栏旁边时,你可以通过刷新页面来测试它

[代码1-Steam Web API脚本userInfo.php]

$api_key = "XXXXXXXXXXXXXXX"; // Insert API Key here!

    $urla = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" . $api_key; 
    $urlb = "&steamids=";
    $urlc = $urla . $urlb;
    $url = $urlc . $_SESSION['steamid'];
    $ch = curl_init();
    curl_setopt( $ch, CURLOPT_URL, $url);
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
    $content = curl_exec($ch);
    curl_close($ch);
    $content = json_decode($content, true);

    $_SESSION['sp_steamid'] = $content['response']['players'][0]['steamid'];
    $_SESSION['sp_communityvisibilitystate'] = $content['response']['players'][0]['communityvisibilitystate'];
    $_SESSION['sp_profilestate'] = $content['response']['players'][0]['profilestate'];
    $_SESSION['sp_personaname'] = $content['response']['players'][0]['personaname'];
    $_SESSION['sp_lastlogoff'] = $content['response']['players'][0]['lastlogoff'];
    $_SESSION['sp_profileurl'] = $content['response']['players'][0]['profileurl'];
    $_SESSION['sp_avatar'] = $content['response']['players'][0]['avatar'];
    $_SESSION['sp_avatarmedium'] = $content['response']['players'][0]['avatarmedium'];
    $_SESSION['sp_avatarfull'] = $content['response']['players'][0]['avatarfull'];
    $_SESSION['sp_personastate'] = $content['response']['players'][0]['personastate'];
    $_SESSION['sp_realname'] = $content['response']['players'][0]['realname'];
    $_SESSION['sp_primaryclanid'] = $content['response']['players'][0]['primaryclanid'];
    $_SESSION['sp_timecreated'] = $content['response']['players'][0]['timecreated'];
    $_SESSION['sp_loccountry'] = $content['response']['players'][0]['loccountrycode'];

    $_SESSION['sp_steamid32'] = GetSteam32ID($_SESSION['steamid']);

    date_default_timezone_set("GMT");
    $_SESSION['sp_currenttime'] = date("Y-m-d H:i:s", time());
    $_SESSION['sp_clientip'] = $_SERVER['REMOTE_ADDR']." | ".$_SERVER['HTTP_X_FORWARDED_FOR'];
[代码2-Javascript函数]

<script type="text/javascript">
function loaddata()
{
    document.getElementById('page_loading').style.display = "block";
    $.post("<? echo $js_url."connect.php?refresh_steamdata=true&refresh_databasedata=true".$js_url_par; ?>",{
    },
    function(data)
    {
            document.getElementById('page_loading').style.display = "none";
            <? if($curpage == "My Account") { ?>
            document.getElementById("profileloadingBlanket").style.display = "none";
            document.getElementById("profileloadingDiv").style.display = "none";
            $("#profile_Area").load("account.php #profile_Area").fadeIn();
            <? } ?>
    });
}

loaddata();
</script>
[代码4-在每个页面中运行include函数,就像javascript函数一样。]

$refreshall= $_GET["refreshdata"];
include("../connections/connect.php");
[编辑1] 我有一些想法: 1.在卸载页面之前,可以通过某种方式中止javascript加载功能。
2.在卸载页面之前,php函数可能会以某种方式被破坏。启动该代码会使json文件工具在40秒后停止加载。

也许我错过了它,但我没有看到任何问题。如果你的问题/问题出现了怎么办?我有一些想法:1。在卸载页面之前,可以通过某种方式中止javascript加载功能。2.在卸载页面之前,php函数可能会以某种方式被破坏。启动该代码将使json文件工具在40秒后停止加载。您仍然没有提出任何问题。
$refreshall= $_GET["refreshdata"];
include("../connections/connect.php");