1
내가 DB를 쿼리에서 돌아지고있어 일부 JSON 디코딩을 시도 붙어 점점 계속 :PHP : JSON 디코딩
내 결과를 =
{"queryResults":[{"id":"1","pageName":"home","blurb":"<p>knowInk Publishing is a Media Professional Services firm dedicated to integrating existing publications into the technology of today, introduce the publications of the future and provide traditional services for the print industry.<\/p> \r\n<p>From e-publishing, e-singles, mobile, web and print design and development, printing on demand and our editorial services we can provide a nuts to soup solution to your publishing needs.<\/p>\r\nLearn more about how KI can help you.","imgPath":"images\/img_homepage.jpg"},{"id":"3","pageName":"about","blurb":"This is where the about text would go. ","imgPath":"images\/img_about.jpg"},{"id":"4","pageName":"services","blurb":"This is where we would talk about the services we can provide","imgPath":"images\/img_services.jpg"},{"id":"5","pageName":"marketplace","blurb":"This is where we will discuss our marketplace, where you can buy and sell things","imgPath":"images\/img_marketplace.jpg"}]}
나는 세션 VAR에 JSON을 넣어입니다 그것을 검색 할 수 있습니다. 그러나 내가 그것을 파헤 치러 갈 때 나는 갇혀있다.
print $_SESSION['basicPageHTML']; //works fine, gives me the json above
$code = json_decode($_SESSION['basicPageHTML']);
print count($code->queryResults); //this seems right, gives me 4
foreach($code->queryResults as $thisKey => $thisValue) {
//I can't do anything here.
}
내가 조금 PHP에서 멀리 봤는데 당신이 너무 빨리 잊어 방법 재미 ...
또한 php에서 벗어 났으므로 : 세션 대신 직렬화가 더 안전 할 수 있습니다. 그러나 시나리오에 따라 다르므로 결정할 코드를 충분히 볼 수 없습니다. – Digitalis