Home > Backend Development > PHP Tutorial > PHP接口 给C#程序调用 返回值以json格式 如何实现?是return还是echo

PHP接口 给C#程序调用 返回值以json格式 如何实现?是return还是echo

WBOY
Release: 2016-06-13 12:26:10
Original
1011 people have browsed it

PHP接口 给C#程序调用 返回值以json格式 怎么实现?是return还是echo
求解!!!PHP接口 给C#程序调用 返回值以json格式 怎么实现?是return还是echo,到底是用return返回吗?
echo 有用吗?
------解决思路----------------------
当然是 echo 啦
------解决思路----------------------
return只能在php内部使用
对外,你要给别人解析,你就理解成输出,用echo
------解决思路----------------------
当然是echo了,如果是json最好加上header标识

<br /><?php<br />$ret = array(<br />    'name' => 'fdipzone'<br />);<br />header('content-type:application/json;charset=utf8');<br />echo json_encode($ret);<br />?><br />
Copy after login

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template