Öncelikle ilgin için teşekkür ederim ama aşağıdaki kodu
<?php
header("Content-Type: text/plain; charset=UTF-8");
$results = (object) array(
"status" => true,
"category" => (object) array(
"ID" => 1,
"title" => "title",
"description" => "description"
),
"posts" => array(
(object) array(
"ID" => 1,
"type" => "post",
"title" => "title",
"content" => "content",
"excerpt" => "excerpt",
"published_at" => (time() - (72 * 60 * 60)),
"comments" => array()
),
(object) array(
"ID" => 2,
"type" => "post",
"title" => "title",
"content" => "content",
"excerpt" => "excerpt",
"published_at" => (time() - (24 * 60 * 60)),
"comments" => array()
)
)
);
print_r(
json_encode(
$results,
JSON_PRETTY_PRINT
)
);1.php eklediğimde ve tarayıcıdan 1.php çalıştırdığımda şu hatayı almaktayım
Warning: json_encode() expects parameter 2 to be long, string given in /home/***/public_html/demo/maps/list.php on line 38