Skip to content

Instantly share code, notes, and snippets.

@nicholasareed
Created December 12, 2011 07:38
Show Gist options
  • Save nicholasareed/1465697 to your computer and use it in GitHub Desktop.
Save nicholasareed/1465697 to your computer and use it in GitHub Desktop.
PHP Parse POST string to JSON object
<?php
// Get the raw post string
$raw_post = @file_get_contents('php://input');
// Parse using json_decode
$post = json_decode($raw_post);
// $post now contains the JSON object
echo $post->from_address;
//: 'from_address@example.com'
?>
@carry
Copy link

carry commented Dec 12, 2011

能解释一下吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment