Created
December 12, 2011 07:38
-
-
Save nicholasareed/1465697 to your computer and use it in GitHub Desktop.
PHP Parse POST string to JSON object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
能解释一下吗