About the front and rear desk, ask for help

Source: Internet
Author: User
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);
?>
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.