由于缺少源代码文档,我需要一个PHP解决方案来返回下面代码的正确服务器响应,以进行调试。任何方向赞赏。我只需要一个PHP脚本来回答"这部分代码等待假设我登录到虚拟Web服务。感谢。
json = string.Format("{{\"name\":\"{0}\",\"pw\":\"{1}\"}}", usertext, pwtext);
client.Headers[HttpRequestHeader.ContentType] = "application/json";
result = client.UploadString(UrlBase.urlBase + "Login.php", json);
if (result.Contains(usertext) && result.Contains(pwtext) && result.Contains("\"id\""))
{
textError.Text = "You are logged in";
SaveID(result);
}
编辑 - 我目前在PHP中的尝试:
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$data = json_decode(file_get_contents("php://input"));
echo $data;
}
?>