方法一:
post发送:
function curl_post($url, $post_data)
{
error_reporting(E_WARNING);
$delimiter = uniqid();
c h = c u r l i n i t ( ) ; c u r l s e t o p t ( ch = curl_init(); curl_setopt( ch=curli?nit();curls?etopt(ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data );
curl_setopt($ch, CURLOPT_URL, $url);
$header = array("Content-Type:multipart/form-data;charset=utf-8", 'Content-Length: ' . strlen($post_data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); //设置HTTP头
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //设置是否返回信息
$info = curl_exec($ch); //接收返回信息
if (curl_errno($ch)) {
print curl_error($ch);
}
curl_close($ch); //关闭curl链接
$result = json_decode($info, true);
return $result;
}
数据组合:
public function actionImA(){
var_dump( P O S T ) ; v a r d u m p ( _POST); var_dump( P?OST);vard?u</