1 回答
TA贡献1831条经验 获得超10个赞
试试这个
page_login.php
$email = "test@gmail.com";
$password = "123";
$json = array('email' => $email, 'password' => hash("sha256",$password));
$json = json_encode($json);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://localhost/login.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array("json" => $json)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close ($ch);
echo $server_output;
登录.php
$json=json_decode($_REQUEST["json"],true);
foreach ($json as $key => $value) {
echo $key . ": " . $value;
echo "<BR>";
}
- 1 回答
- 0 关注
- 259 浏览
添加回答
举报