Created
August 25, 2017 03:58
-
-
Save soiqualang/60091c634f18cb76b415f38e43b57087 to your computer and use it in GitHub Desktop.
Service để Ajax gọi tới get data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//get URL cua file hien tai; | |
$baseUrl = $_SERVER['PHP_SELF']; | |
//kiem tra thong tin request den | |
if (isset($_POST['getMember']) && $_POST['getMember'] == 'view') | |
{ | |
//wating 1s truoc khi thuc thi | |
sleep(1); | |
//tao mang member | |
$member = array('username' => 'phucvh' | |
,'password' => '123456' | |
,'email' => 'ahoangphuc@gmail.com'); | |
//dung ham json_encode de chuyen mang $member thanh chuoi JSON | |
echo json_encode($member); | |
//ket thuc tra ve du lieu va stop khong cho chay tiep | |
die; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment