Questions about the PHP interface "Novice rookie seeking guidance"
Leader let's write an interface
PHP provides data
I am a circle, not I do not study, I have been online search 1 days, really can not find, it may be my concept is wrong, but the exact words are said.
Want to ask the Elders to guide the maze, the best specific point, the idea to say through the line, do not need code case.
(Of course, there is no specific task, it should be a project, used to do a small small module, such as search function, get the characters in the URL to determine whether to display content, etc.)
------to solve the idea----------------------
Provide JSON-formatted data on the line ...
------to solve the idea----------------------
You understand the right, is to get, and then return the value. The form of the value depends on the expected format of the other person.
------to solve the idea----------------------
It means that the other person wants to format the data, and you give it back what format data.
------to solve the idea----------------------
Interface is, get what parameter, return what result
such as test.php
Request
Type
Name
Response
Success True or False
$type = isset ($_get[' type ')? $_get[' type ']: ';
$name = isset ($_get[' name ')? $_get[' name ']: ';
$ret = Array ();
if ($type ==1 && $name = = ' Fdipzone ') {
$ret [' success '] = true;
}else{
$ret [' success '] = false;
}
echo Json_encode ($ret);