Rumah  >  Artikel  >  pembangunan bahagian belakang  >  php数组的有关问题

php数组的有关问题

WBOY
WBOYasal
2016-06-13 10:20:12842semak imbas

php数组的问题
我也不知道是什么问题,
我有个数组(从数据库中取出来的)
Array
(
  [0] => 2
  [testconment_id] => 2
  [1] => 
  [testconment_userid] => 
  [2] => 2
  [testconment_testid] => 2
  [3] => 
  [testconment_typeid] => 
  [4] => 
  [testconment_flag] => 
  [5] => 你好啊啊啊啊
  [testconment_content] => 你好啊啊啊啊
  [6] => 2012-05-02 05:25:03
  [testconment_date] => 2012-05-02 05:25:03
)

通过循环取值
foreach($commentList as $v){
$commentTemp["id"]=$v["testconment_id"];
$commentTemp["userid"]=$v["testconment_userid"];
$commentTemp["testid"]=$v["testconment_testid"];
$commentTemp["typeid"]=$v["testconment_typeid"];
$commentTemp["flag"]=$v["testconment_flag"];
$commentTemp["content"]=$v["testconment_content"];
$commentTemp["date"]=$v["testconment_date"];
array_push($commentArray,$commentTemp);
}
我将$commentArray打印出来
Array
(
  [0] => Array
  (
  [id] => 2
  [userid] => 2
  [testid] => 2
  [typeid] => 2
  [flag] => 2
  [content] => 2
  [date] => 2
  )
 
  [1] => Array
  (
  [id] => 2
  [userid] => 2
  [testid] => 2
  [typeid] => 2
  [flag] => 2
  [content] => 2
  [date] => 2
  )
 
  [2] => Array
  (
  [id] => 
  [userid] => 
  [testid] => 
  [typeid] => 
  [flag] => 
  [content] => 
  [date] => 
  )
 
  [3] => Array
  (
  [id] => 
  [userid] => 
  [testid] => 
  [typeid] => 
  [flag] => 
  [content] => 
  [date] => 
  )
 
  [4] => Array
  (
  [id] => 2
  [userid] => 2
  [testid] => 2
  [typeid] => 2
  [flag] => 2
  [content] => 2
  [date] => 2
  )
 
  [5] => Array
  (
  [id] => 2
  [userid] => 2
  [testid] => 2
  [typeid] => 2
  [flag] => 2
  [content] => 2
  [date] => 2
  )
 
  [6] => Array
  (
  [id] => 
  [userid] => 
  [testid] => 
  [typeid] => 
  [flag] => 
  [content] => 
  [date] => 
  )
 
  [7] => Array
  (
  [id] => 
  [userid] => 
  [testid] => 

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn