《PHP應用:PHP中使用file_get_contents post數據代碼例子》要點:
本文介紹了PHP應用:PHP中使用file_get_contents post數據代碼例子,希望對您有用。如果有疑問,可以聯系我們。
廢話不多說,上代碼:PHP利用
代碼以下:
$data = array(
??? 'name' => 'Joe',
??? 'website' => 'www.jb51.net'
);
$data = http_build_query($data);
$data = json_encode($data);
$json = file_get_contents($url, 0, stream_context_create(array(
??? 'http' => array(
??????? 'timeout' => 30,
??????? 'method' => 'POST',
??????? 'content' => $data
??? )
)));
歡迎參與《PHP應用:PHP中使用file_get_contents post數據代碼例子》討論,分享您的想法,維易PHP學院為您提供專業教程。
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/12232.html