有没有办法可以访问php下面的特定数组元素? 我试过这些代码,但似乎没有工作: 1)$ array [0] ['description'] 2)$ array-> description
array (size=5) 'question0' =>
array (size=7)
'description' => string 'Lorem ipsum' (length=11)
'strCorrectResponse' => string 'Lorem ipsum;' (length=11)
'strStatus' => string 'incorrect' (length=9)
'strUserResponse' => string 'Lorem ipsum' (length=1)
'nWeight' => string '1' (length=1)
'nPoints' => string '0' (length=1)
'nQuestionNumber' => string '1' (length=1) 'question1' =>
array (size=7)
'description' => string 'Lorem ipsum' (length=11)
'strCorrectResponse' => string 'Lorem ipsum' (length=11)
'strStatus' => string 'incorrect' (length=9)
'strUserResponse' => string 'Lorem ipsum' (length=11)
'nWeight' => string '1' (length=1)
'nPoints' => string '0' (length=1)
'nQuestionNumber' => string '2' (length=1)
答案 0 :(得分:2)
只需按下兔子洞下的钥匙:
$arr = array ('question0' => array('description' => string 'Lorem ipsum' (length=11)
| | |
$arr ['question0'] ['description']
$arr['question0']['description'] => Lorem ipsum