我想使用数组数组中的值,比如:

$result  = $conn->query("SELECT performer,file_id,title,duration FROM
    databasebot WHERE performer = '$message' or title = '$message'");

$poets = array(
    "keyboard" => array()
);


while ($row = mysqli_fetch_row($result)) {
    $poets['keyboard'][] = array($row[2],$row[1]);
}

我想重复$poets$row[1]的值。我该怎么做?

最佳答案

$poets['keyboard']中遍历数组。在每个元素中,$poets[1]将位于[1]子元素中。

foreach ($poets['keyboard'] as $kb) {
    echo $kb[1];
}

关于php - 我如何使用数组中的值? (php),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47208074/

10-09 19:42