Possible Duplicate:
Can't decode JSON string in php
I'm at my wits end here, and I can't figure it out. My code was working correctly locally (using xamp) but now it won't work.
Bu kodu çalıştırdığınızda:
echo "passed in parameter" . $_POST["jsoned"];
$unjasoned = json_decode("[\"23\",[],[[\"a@a.a\",\"2011-01-08\"]]]");
die("\ntype\n\t". gettype($unjasoned) . "\n\n\nAmount\n\t" . $unjasoned[0]);
Alıyorum:
passed in parameter[\"23\",[],[[\"a@a.a\",\"2011-01-08\"]]]
type
array
Amount
23
Hangi exactly i istediklerini
I $_POST["jsoned"]
hangi yukarıdaki sonucu görmek açıkçası im burada elle ekleme ne tam olarak aynı olarak geçirilen değişkeni kullandığınızda sorun olur ancak.
bu yüzden bu yerine (aynı tam giriş) yaparsanız:
echo "passed in parameter" . $_POST["jsoned"];
$unjasoned = json_decode($_POST["jsoned"]);
die("\ntype\n\t". gettype($unjasoned) . "\n\n\nAmount\n\t" . $unjasoned[0]);
Alıyorum:
passed in parameter[\"23\",[],[[\"a@a.a\",\"2011-01-08\"]]]
type
NULL
Amount
yani ...... NE CEHENNEM OLUYOR?! Eğer herhangi bir ipucu benimle bunları paylaşmak varsa, hasta ebediyen minnettar LÜTFEN.
ps. benim sunucu php sürümünü çalıştıran 5.2.13