如何使用数组中的循环(php)?
我想使用重复循环,而等。。。在php中的数组中:如何使用数组中的循环(php)?,php,mysql,arrays,for-loop,telegram-bot,Php,Mysql,Arrays,For Loop,Telegram Bot,我想使用重复循环,而等。。。在php中的数组中: for($x = 0; $x < $arrlength; $x++) { $poets = array( 'keyboard' => array( array($saves[$x]) // this is just one array i don't want this ! ), ); $url= "https://api.telegr
for($x = 0; $x < $arrlength; $x++) {
$poets = array(
'keyboard' => array(
array($saves[$x]) // this is just one array i don't want this !
),
);
$url= "https://api.telegram.org/bot".$token."/sendMessage?
chat_id=".$chat_id."&text=".$text."&reply_markup=".$jsonPoets;
file_get_contents($url);
}
这不管用,我想这样做:
for($x = 0; $x < $arrlength; $x++) {
$poets = array(
'keyboard' => array(
//i wanna do like this ...
array($saves[$x])
//array($saves[$x])
//array($saves[$x])
.
.
.
)
);
$url= "https://api.telegram.org/bot".$token."/sendMessage?
chat_id=".$chat_id."&text=".$text."&reply_markup=".$jsonPoets;
file_get_contents($url);
}
这意味着我想用循环重复在数组中创建多个数组
$poets= array('keyboard' => array());
for($x = 0; $x < $arrlength; $x++) {
$poets['keyboard'][] = array($saves[$x]);
}
像这样