php new stdClass array 实例代码

php new stdClass array 实例代码

 1 $searchResults = array ();//
 2 //$obj = array ("rs"=>array(),"count"=>0);//这种只能用$searchResults['rs']方式读取
 3         $obj = new stdClass();
 4         $obj->rs = array();
 5         $obj->count = 0;
 6         if(empty($searchResults)){
 7             $searchResults = $obj;
 8         }
 9         $searchResult = $searchResults->rs;
10 //object(stdClass)#14 (2) { ["rs"]=> array(10) } ["count"]=> int(48) } 

 

posted @ 2014-06-21 21:23  大自然的流风  阅读(812)  评论(0编辑  收藏  举报