Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/452.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 而(1)JSON注入_Javascript_Php_Ajax_Json - Fatal编程技术网

Javascript 而(1)JSON注入

Javascript 而(1)JSON注入,javascript,php,ajax,json,Javascript,Php,Ajax,Json,我读了这篇文章 可以帮助什么样的php脚本呢 我试着 $time=time(); $hash=md5(mt_rand(1,200000)); $arr = array('time' => $time, 'hash' => $hash); while(1);json_encode($arr); 我的回答有错误 致命错误:第6行的C:\xampp\htdocs\foo\1.php中超过了30秒的最大执行时间非常感谢Girish 作品: 1.php <?php $time=tim

我读了这篇文章

可以帮助什么样的php脚本呢

我试着

$time=time();
$hash=md5(mt_rand(1,200000));

$arr = array('time' => $time, 'hash' => $hash);
while(1);json_encode($arr);
我的回答有错误
致命错误:第6行的C:\xampp\htdocs\foo\1.php中超过了30秒的最大执行时间
非常感谢Girish 作品:

1.php

<?php
$time=time();
$hash=md5(mt_rand(1,200000));

$arr = array('time' => $time, 'hash' => $hash);
echo "while(1);".json_encode($arr);

它正在执行一个无限循环并对$arr进行编码,为什么要这样做?您应该将JSON字符串数据
echo“while(1);”作为字符串附加。JSON_encode($arr)
@Girish yesp,发出请求的客户端应在(1)时去除
在解析JSON响应之前。的可能重复项
responseText=req.responseText.substring(9);
            var obj=JSON.parse(responseText);

            statusElem.innerHTML = obj.hash