Home >Backend Development >PHP Tutorial >PHP写的server端,怎么接收手机客户端传来的json数据

PHP写的server端,怎么接收手机客户端传来的json数据

WBOY
WBOYOriginal
2016-06-13 10:14:23976browse

PHP写的server端,如何接收手机客户端传来的json数据
PHP写的server端,如何接收手机客户端传来的json数据?


------解决方案--------------------
$link = fopen("php://input", 'r');
打开php的输入流,所有提交到该文件的数据都可用用此获取
$json = fread($link, 10000);
读取刚才打开的输入流,最多读取10000字节
官方手册上是英文的,找了篇中文的解释 http://www.perfgeeks.com/?p=150

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn