卷曲代码:卷曲远程登录埃罗
$username = $_POST["email"];
$password = $_POST["password"];
$headers= array('Accept: application/json','Content-Type: application/json');
$url="http://localhost/hrm_1.7/source/admin/login";
$data = array('email'=>$username,'password'=>$password);
$postinfo = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postinfo);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_exec($ch);
curl_setopt($ch, CURLOPT_URL,"http://localhost/hrm_1.7/source/admin/dashboard");
$html = curl_exec($ch);
curl_close($ch);
AJAX代码:
$.ajax({
type: "POST",
url: " http://localhost/hrm_1.7/source/admin/login ",
dataType: 'json',
data: $('#login-form').serialize()
}).done(function(response) {
if(response.status == "success")
{
window.location.href= "http://localhost/hrm_1.7/source/admin/dashboard";
}
});
AJAX代码是工作的罚款,并成功登录它并重定向到dashboard.But我想用卷曲的事情。我的卷发代码有什么问题?
是否有管理/仪表板的任何$ _ POST reciver类型的方法? –
@AniruddhaChakraborty,我不知道我的ajax代码正在工作,我需要知道我的卷发代码有什么问题。 – afsarkhan10182