服务器端函数
function order_kb(){
$expressodd[0]['odd']='560860393435';
$expressoddjson = json_encode($expressodd);
return $expressoddjson;
}
客户端请求php文件
$post_data = array () ;
$url = 'http://www.test.com/index.php?m=user&a=order_kb' ;
$o = "" ;
foreach ($post_data as $k=>$v)
{
$o.="$k=".urlencode($v)."&";
}
$data=substr($o,0,-1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
curl_close($curl);
print_r(json_decode($result,TRUE));
print_r(json_decode($result,TRUE)[0]['odd']);//打印出来看结果
?>
为什么得不到返回值?打印出来是空白的页面
这个网站在第一次访问时会执行如下 js 代码
function setCookie(c_name, value, expiredays) { document.cookie = c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";expires=" + expiredays) + ";path=/";}function getHostUri() { var loc = document.location; return loc.toString();}var exdate=new Date();exdate.setDate(exdate.getDate()+1);setCookie('DOAAuthReferrer', document.referrer, exdate.toUTCString());setCookie('DOADFgsjnrSFgsg329gaFGa3ggs9434sgSGS43tsgSHSG35', '#e25d0c3c68dea6df48ffe0664f9d86d24c31ff1d#FLBN#1467097484#1739593330#', 'Tue, 28 Jun 2016 07:04:44 GMT');try { location.reload(true); } catch (err1) { try { location.reload(); } catch (err2) { location.href = getHostUri(); } }
这个网站在第一次访问时会执行如下 js 代码
function setCookie(c_name, value, expiredays) { document.cookie = c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";expires=" + expiredays) + ";path=/";}function getHostUri() { var loc = document.location; return loc.toString();}var exdate=new Date();exdate.setDate(exdate.getDate()+1);setCookie('DOAAuthReferrer', document.referrer, exdate.toUTCString());setCookie('DOADFgsjnrSFgsg329gaFGa3ggs9434sgSGS43tsgSHSG35', '#e25d0c3c68dea6df48ffe0664f9d86d24c31ff1d#FLBN#1467097484#1739593330#', 'Tue, 28 Jun 2016 07:04:44 GMT');try { location.reload(true); } catch (err1) { try { location.reload(); } catch (err2) { location.href = getHostUri(); } }
那你就太无聊了
那你就太无聊了
实际请求$url = 'http://www.danhaoxia.com/index.php?m=user&a=order_kb' ; 麻烦看下
$url = 'http://www.danhaoxia.com/index.php?m=user&a=order_kb' ;echo file_get_contents($url);
$url = 'http://www.danhaoxia.com/index.php?m=user&a=order_kb' ;echo file_get_contents($url);
$url = 'http://www.danhaoxia.com/index.php?m=user&a=order_kb' ;echo file_get_contents($url);
$url = 'http://www.danhaoxia.com/index.php?m=user&a=order_kb' ;echo file_get_contents($url);
function order_kb(){ $expressodd[0]['odd']='560860393435'; $expressoddjson = json_encode($expressodd); return $expressoddjson;}
去是去掉了,但是也只剩下了 BOM 头了
你是怎么调用 order_kb 函数的?
去是去掉了,但是也只剩下了 BOM 头了
你是怎么调用 order_kb 函数的?
<?php$post_data = array () ;$url = 'http://www.test.com/index.php?m=user&a=order_kb' ;$o = "" ;foreach ($post_data as $k=>$v){ $o.="$k=".urlencode($v)."&";}$data=substr($o,0,-1);$ch = curl_init();curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_HEADER,0);curl_setopt($ch, CURLOPT_URL,$url);curl_setopt($ch, CURLOPT_POSTFIELDS, $data);$result = curl_exec($ch);curl_close($curl);print_r(json_decode($result,TRUE));print_r(json_decode($result,TRUE)[0]['odd']);//打印出来看结果?>
去是去掉了,但是也只剩下了 BOM 头了
你是怎么调用 order_kb 函数的?
<?php$post_data = array () ;$url = 'http://www.danhaoxia.com/index.php?m=user&a=order_kb' ;$o = "" ;foreach ($post_data as $k=>$v){ $o.="$k=".urlencode($v)."&";}$data=substr($o,0,-1);$ch = curl_init();curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_HEADER,0);curl_setopt($ch, CURLOPT_URL,$url);curl_setopt($ch, CURLOPT_POSTFIELDS, $data);$result = curl_exec($ch);curl_close($curl);print_r(json_decode($result,TRUE));print_r(json_decode($result,TRUE)[0]['odd']);//打印出来看结果?>
order_kb 不是服务端的函数吗?你是怎么调用的?
order_kb 不是服务端的函数吗?你是怎么调用的?
但他并没有返回数据,你没有开启 ajax 模式吧?
但他并没有返回数据,你没有开启 ajax 模式吧?
没有,就是不知道为什么return的值会取不到 你没有开启 ajax 模式,order_kb 的返回值怎么会输出?
你都不看手册的吗?
你没有开启 ajax 模式,order_kb 的返回值怎么会输出?
你都不看手册的吗?