{ "jwc_grades": { "2011": { { } } "2012": { { } } "2013": { { } } "2014": { { } } } } 怎样用for循环实现上面的数组 其中2011等数字是变量
这是在写教务系统么...
$jwc_grades = array(); $fromYear = 2011; $toYear = (int)date("Y"); for($year = $fromYear; $year<=$toYear; $year++) { $jwc_grades[$year] = array(); //do whatever u want... } $arr = compact('jwc_grades'); print_r( json_encode($arr) );
这是在写教务系统么...