Home >Backend Development >PHP Tutorial >PHP handles json data from Python's Post
__author__ = 'jiezhi' import urllib import urllib2 data = {'name': 'jiezhi', 'age': '24'} ret = urllib2.urlopen(url='http://jiezhiblog.com/test.php', data=urllib.urlencode(data)) print ret.read()
__author__ = 'jiezhi' import urllib2 import json data = {'name': 'jiezhi', 'age': '24'} ret = urllib2.urlopen(url='http://jiezhiblog.com/test.php', data=json.dumps(data)) print ret.read()
<?php $input = file_get_contents("php://input"); var_dump($input); if ($input){ print_r($input); $arr = json_decode($input,true); echo "arr"; print_r($arr); } ?>
The above introduces PHP's processing of json data from Python's Post, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.