在我看来,我的控制器功能中有一个典型的用户名和密码输入表单
public function login() {
$username = $_POST['username'];
$password = md5($_POST['password']);
//if user dont exist in the in the local database it will be validated thru the API
if(!$this->is_registered_email($_POST['username'])) {
$ret = file_get_contents('http://www.XXXXd48170846c1e937640ae7e9f6743089c3c2a9074/auth/{"user":"' . $username . '","pass":"' . $password . '"}');
$ret = json_decode($ret);
} else {
//this is where if the user exist in the local database and in the API database
// and if the user input a wrong password
}
//this will return user details from the API if the user exists
$data = array('response' => $ret);
}
我在流程中添加了评论