I am using WordPress with the JSON API plugin (http://wordpress.org/extend/plugins/json-api/) to create responses to our other site.
I came across a really strange problem (we use PHP 5.3.6) when I pass the following array http://pastebin.com/xdfYjrvK to json_encode () it gives me this (with json content-type): http: // pastebin. com / T61XGPP5
So, shit at the beginning, in the above example it is 2609 and 0 at the end, it changes depending on the size of the response, more content → a higher six-digit number. It also appears only when the number of answers is “high enough,” so it works with small answers.
At first I thought it was a plugin, but it works locally (on two different Mac OS X computers), and we updated all the packages on VPS (Debian, Apache, Nginx, PHP) to the latest versions.
It is displayed only when sending a content type, and not when displaying the result of $ with plain text instead of the / json application:
$charset = get_option('blog_charset'); if (!headers_sent()) { header('HTTP/1.1 200 OK', true); header("Content-Type: application/json; charset=$charset", true); } echo $result;
$ charset installs in utf-8.
The Google chrome console says: "The resource is interpreted as a Document, but is transmitted using an application such as MIME / json."
So, does anyone know what is going on here?
source share