Javascript 双柱发行
我正在做离子+角度+编码点火器的项目。 当我在做身份验证登录Api时,我在做双post 这是我的Login.htmlJavascript 双柱发行,javascript,php,angularjs,codeigniter,Javascript,Php,Angularjs,Codeigniter,我正在做离子+角度+编码点火器的项目。 当我在做身份验证登录Api时,我在做双post 这是我的Login.html <ion-view view-title="Login" hide-nav-bar="true"> <ion-content class="login"> <img src="img/logo.png" alt=""> <form ng-submit="saveConn()"> <div cla
<ion-view view-title="Login" hide-nav-bar="true">
<ion-content class="login">
<img src="img/logo.png" alt="">
<form ng-submit="saveConn()">
<div class="list list-inset">
<label class="item item-input">
<input type="text" placeholder="Username" ng-model="config.username">
</label>
<label class="item item-input">
<input type="password" placeholder="Password" ng-model="config.password">
</label>
<button class="button button-full button-assertive" name="button">Masuk</button>
</form>
</div>
</ion-content>
</ion-view>
下面是我当前用于登录的Codeigniter Api:
public function Login()
{
$obj = json_decode(file_get_contents('php://input'));
if ($this->Prospect->check_user($obj->username, md5($obj->password)) === TRUE)
{
$response = array(
'Success' => true,
'Info' => 'Login Sukses');
}else
{
$response = array(
'Success' => false,
'Info' => 'Username atau Password Salah');
}
echo $this->json_prefix . json_encode($response);
}
我转到Chrome控制台,切换到“网络”,看到登录Api被调用了两次,第一个状态为false,第二个状态为success(我正确输入用户名和密码)。
任何帮助都会很感激
编辑
第一原材料:
{成功:false,信息:“用户名和密码不匹配”,用户名:null,密码:null}
第二原材料:
{Success:true,Info:“Login Sukses”,Username:“edwin”,Password:“caitlin”}请求的内容大小不同-您确定是同一个请求吗?第1次与第2次的对比到底是什么样的?你能发布原始请求吗?我在@ovidiudolhat编辑了我的帖子,但是请求的内容大小不同-你确定是同一个请求吗?第一对第二到底是什么样的?你能发布原始请求吗?我编辑了我的帖子@OvidiuDolha
public function Login()
{
$obj = json_decode(file_get_contents('php://input'));
if ($this->Prospect->check_user($obj->username, md5($obj->password)) === TRUE)
{
$response = array(
'Success' => true,
'Info' => 'Login Sukses');
}else
{
$response = array(
'Success' => false,
'Info' => 'Username atau Password Salah');
}
echo $this->json_prefix . json_encode($response);
}