$curlPost = array(
'unid' => isset($data['unid'])?$data['unid']:'',
'term_suiji' => isset($data['suiji'])?$data['suiji']:'',
'wxorder_id' => 'SYKX'.date('YmdHis').rand(10000,99999),
'pay_money' => '0',
'pay_date' => date('Y-m-d H:i:s'),
);
$ch = curl_init();//初始化curl
curl_setopt($ch, CURLOPT_URL,$GLOBALS['yurl'].'?service=App.Term.BuyTerm');
curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);//运行curl
curl_close($ch);
$data = json_decode($data,true);
// echo '<pre>';
if($data['ret'] == 200){
$this->Session->setFlash("成功");
}else{
$this->Session->setFlash("失败:".$data['msg']);
}
echo "<script> var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
parent.location.href='../Buy/Index';
</script>";
// window.parent.location.reload(); //刷新父页面
exit();
curl 调用接口
最新推荐文章于 2024-02-01 19:14:00 发布