如何通过 JSON 将表单变量传递到另一个页面?我创建了两个 php 文件,文件名为 page_login.php 和 login.php。但是在运行 login_post.php 时,$json 值无法传递给 login.php
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,"https://localhost/login.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close ($ch);
登录.php:
$json=json_decode($_REQUEST["json"],true);
print $json;
慕哥6287543