About front and rear desk, ask for help, online etc.
Modify the Calendar program. Requirements: Place an array of special festivals stored in the background, storing information (or more complex arrays) in an array of Key-value key values. The foreground will pass the date backstage, receive, judge, return. The front and back communication must be in JSON format.
I really don't get it.
------to solve the idea----------------------
Very simple.
There's a data sheet on the back, a special date, Key=>value,
Because it is a special date, key should be a date, and value should be what the date is.
For example
$arr = Array (
' 01-01 ' = ' New Year's Day ',
' 02-14 ' and ' Valentine's Day ',
' 03-08 ' and ' Women's episodes '
);
Front desk, enter the date, and then return to the table according to the date of the special day. The previous message uses JSON format.
Front Office code:
Please enter a date such as 01-01
Rear code:
Header (' Content-type:application/json ');
$arr = Array (
' 01-01 ' = ' New Year's Day ',
' 02-14 ' and ' Valentine's Day ',
' 03-08 ' and ' Women's episodes '
);
$d = Isset ($_post[' d ')? $_post[' d ']: ';
if ($d = = ") {
echo json_encode (Array (' success ' =>false));
Exit ();
}
$ret = Array ();
if (Isset ($arr [$d])) {
$ret = Array (
' Success ' = True,
' Value ' = $arr [$d]
);
}else{
$ret = Array (
' Success ' = False,
' Value ' = '
);
}
echo Json_encode ($ret);
?>