php中的循环和条件数组
我想在数组中创建循环和条件,以便从中创建日程日历php中的循环和条件数组,php,yii,calendar,yii-extensions,Php,Yii,Calendar,Yii Extensions,我想在数组中创建循环和条件,以便从中创建日程日历 到 $this->widget('ext.yiicalendar.yiicalendar',数组 ( 'linksArray'=>数组 ( $a=0; 而($a阵列 ( “标题”=>“哈哈哈!:]”, 'style'=>'font-weight:粗体;颜色:红色;', 'href'=>'#' ) } $a=$a+1; } ) )); 但它不工作,请我需要您的帮助:(只需创建新变量来缓存它,然后再将其传递给数组 $my_schedule=[
到
$this->widget('ext.yiicalendar.yiicalendar',数组
(
'linksArray'=>数组
(
$a=0;
而($a<10)
{
如果($a!=0)
{
“2014-12-13”=>阵列
(
“标题”=>“哈哈哈!:]”,
'style'=>'font-weight:粗体;颜色:红色;',
'href'=>'#'
)
}
$a=$a+1;
}
)
));
但它不工作,请我需要您的帮助:(只需创建新变量来缓存它,然后再将其传递给数组
$my_schedule=[];
$a = 0;
while($a < 10) {
if($a != 0){
$my_schedule[] = [
'title'=>'hahaha! :]',
'style'=>'font-weight: bold; color: red;',
'href'=>'#'
];
}
$a++;
}
$this->widget('ext.yiicalendar.YiiCalendar', array('linksArray'=> $my_schedule);
$my_schedule=[];
$a=0;
而($a<10){
如果($a!=0){
$my_时间表[]=[
“标题”=>“哈哈哈!:]”,
'style'=>'font-weight:粗体;颜色:红色;',
'href'=>'#'
];
}
$a++;
}
$this->widget('ext.yiicalendar.yiicalendar',数组('linksArray'=>$my\u schedule);
我不完全明白你们想要什么。但若你们想要数组内部的循环,你们可以试试我的方法。很高兴能帮助你们,乌拜
$this->widget('ext.yiicalendar.YiiCalendar', array
(
'linksArray'=>array
(
$a = 0;
while($a < 10)
{
if($a != 0)
{
'2014-12-13'=>array
(
'title'=>'hahaha! :]',
'style'=>'font-weight: bold; color: red;',
'href'=>'#'
)
}
$a=$a+1;
}
)
));
$my_schedule=[];
$a = 0;
while($a < 10) {
if($a != 0){
$my_schedule[] = [
'title'=>'hahaha! :]',
'style'=>'font-weight: bold; color: red;',
'href'=>'#'
];
}
$a++;
}
$this->widget('ext.yiicalendar.YiiCalendar', array('linksArray'=> $my_schedule);