1 run XAMPP program, see Apache Web Server is running status can be
2 Open subline text, create a new php file, select Save path: Application->xampp->htdocs, click Save
$_post indicates that the interface supports post requests and gets the parameters via post
3 Write code in the new PHP file, here with a simple post method to obtain login authentication, the user name is Dudu. Password 123 to login success as an example
<?php
Get login verification by post
$name = $_post["username"];
$password = $_post["password"];
Get information about valid parameters such as the Client Access server from Post
$result = Array ();
if ($name = "Dudu" && $password = "123") {
$result ["status"] = "0";
$result ["message"] = "Succeed";
} else {
$result ["status"] = "1";
$result ["message"] = "Failed";
}
Convert an array to JSON format printout
Echo (Json_encode ($result));
?>
3. Open the browser and enter http://localhost//Post.php?username=dudu&&password=123 on the URL
The results are as follows, indicating success
{"Status": "0", "message": "Succeed"}
Write PHP background server POST request with subline text