warning: undefined index
static public function frequencyStatus($index) {
$frequency = [
0 => '不重复',
1 => '每天',
2 => '每周',
3 => '每月',
4 => '每年'
];
$text = $frequency[$index];
return $text;
}
ok
static public function frequencyStatus($index) {
switch($index) {
case 0:
$text = '不重复';break;
case 1:
$text = '每天';break;
case 2:
$text = '每周';break;
case 3:
$text = '每月';break;
case 4:
$text = '每年';break;
}
return $text;
// $frequency = [
// 0 => '不重复',
// 1 => '每天',
// 2 => '每周',
// 3 => '每月',
// 4 => '每年'
// ];
// $text = $frequency[$index];
// return $text;
}
网友评论