php实现关于这样数组的办法 求大神支招
巴扎黑
巴扎黑 2017-04-10 15:10:20
0
1
393
{

"jwc_grades": {

        "2011": {

                    {

               }
          }
         "2012": {

                    {

                  }
          }
         "2013": {

                    {

                 }
           }
        "2014": {

                    {

                }
           }
    }
}
怎样用for循环实现上面的数组  其中2011等数字是变量
巴扎黑
巴扎黑

reply all(1)
洪涛

这是在写教务系统么...

$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) );
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template