菜鸟求教,如何返回JSONObject给客户端

WBOY
Release: 2016-06-23 14:26:09
Original
1185 people have browsed it

本人在要实现android客户端登陆,然后服务端返回一个JSONObject给客户端的java程序,求教 如何返回JSONObject
比如sn=>123,fn=>234


回复讨论(解决方案)

json_encode

$rt_info = array("rand"=>$rd,"sessionId"=>session_id());
echo json_encode($rt_info);

这样写可以么,为什么客户端程序调试log显示会把整个PHP文字内容都作为返回值打印出来了,应该怎么返回

source:php.cn
Statement of this Website
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
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!