开发者

What's the PHP equivalent of ASP.NET ashx handlers?

开发者 https://www.devze.com 2022-12-31 01:16 出处:网络
I need to return a JSON encoded response to a flash http 开发者_开发技巧get request. In ASP.NET, I do this with a ASHX handler.

I need to return a JSON encoded response to a flash http 开发者_开发技巧get request.

In ASP.NET, I do this with a ASHX handler. What's the PHP equivalent ? I mean in order that I only get JSON back, and not the <html> etc.


You should put this on top of your script:

header('Content-Type: application/json; charset=utf-8');


  • header('Content-type: application/json');
  • http://php.net/manual/en/function.json-encode.php
0

精彩评论

暂无评论...
验证码 换一张
取 消