Friday, 31 August 2018
Subscribe to:
Post Comments (Atom)
$info = array();
$category = Category::find()->all();
foreach($category as $key => $value) {
$info[]= array(
"name" =>$value->name,
"value" =>$value->description
) ;
}
echo json_encode($info,JSON_FORCE_OBJECT);
{"0":{"name":"test","value":"A"},"1":{"name":"test 2","value":"B"}}
{"category":[{"name":"test","value":"A"},{"name":"test 2","value":"B"}]}
$info2['category']=$info;
echo json_encode($info2);
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment