Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php中的循环和条件数组_Php_Yii_Calendar_Yii Extensions - Fatal编程技术网

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);