-4
내 웹 서비스 용 PHP에서 JSON POST 요청을 처리하려고합니다. 지금까지, 나는이 제목, 아티스트, 장르에 NULL을 반환, 그러나이PHP를 사용하여 JSON POST 요청을 처리하는 방법
$postData = json_decode(file_get_contents('php://input'));
$title = $postData->{"title"};
$artist = $postData->{"artist"};
$genre = $postData->{"genre"};
$data->items[] = array(
'id' => $last + 1,
'title' => $title,
'artist' => $artist,
'genre' => $genre,
"links" => [
array(
"rel" => "self",
"href" => "http://link/webservice/music/$new_id"
),
array(
"rel" => "collection",
"href" => "http://link/webservice/"
)
]
);
있습니다.
내가 뭘 잘못하고 있는지 아는 사람이 있습니까?
자신을 부끄럽게 여긴다. 그런 어리석은 실수. 당신의 도움을 주셔서 감사합니다. – user3182261
완벽하게 괜찮은 친구, 우리 모두가 어딘가에 바로 시작했다! – Darren