问题
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.
回答1:
You should put this on top of your script:
header('Content-Type: application/json; charset=utf-8');
回答2:
header('Content-type: application/json');
- http://php.net/manual/en/function.json-encode.php
来源:https://stackoverflow.com/questions/2888153/whats-the-php-equivalent-of-asp-net-ashx-handlers