0
[0] => Array
(
[title] => Title
[intro] => Into
)
[1] => Array
(
[title] => Title1
[intro] => Into1
)
这是数组,我该如何迭代它并将其值赋给基于数组索引的某个输入字段,如数组索引0将赋值给字段1,和索引1到输入字段2等等。Assign array value to input fields based on array indexes
foreach($articles as $key=>$row)
// if array index is 0
<input type="text" name="test1" value="<?=$row['intro'];?>" />
// if array index is 0
<input type="text" name="test2" value="<?=$row['intro'];?>" />
endforeach
我不认为这个问题是清楚的。扩大你的需求... – Chris
我需要基于数组索引分配数组值到输入字段 –