$file = 'xingxiu.php'; $xx = array( 0=>array('id'=>13,'xingxiu'=>'室宿'), 1=>array('id'=>14,'xingxiu'=>'壁宿'), 2=>array('id'=>15,'xingxiu'=>'奎宿'), 3=>array('id'=>16,'xingxiu'=>'娄宿'), 4=>array('id'=>17,'xingxiu'=>'胃宿'), 5=>array('id'=>18,'xingxiu'=>'昴宿'), 6=>array('id'=>19,'xingxiu'=>'毕宿'), 7=>array('id'=>20,'xingxiu'=>'觜宿'), 8=>array('id'=>21,'xingxiu'=>'参宿'), 9=>array('id'=>22,'xingxiu'=>'井宿'), 10=>array('id'=>23,'xingxiu'=>'鬼宿'), 11=>array('id'=>24,'xingxiu'=>'柳宿'), 12=>array('id'=>25,'xingxiu'=>'星宿'), 13=>array('id'=>26,'xingxiu'=>'张宿'), 14=>array('id'=>27,'xingxiu'=>'翼宿'), 15=>array('id'=>28,'xingxiu'=>'轸宿'), 16=>array('id'=>1,'xingxiu'=>'角宿'), 17=>array('id'=>2,'xingxiu'=>'亢宿'), 18=>array('id'=>3,'xingxiu'=>'氐宿'), 19=>array('id'=>4,'xingxiu'=>'房宿'), 20=>array('id'=>5,'xingxiu'=>'心宿'), 21=>array('id'=>6,'xingxiu'=>'尾宿'), 22=>array('id'=>7,'xingxiu'=>'箕宿'), 23=>array('id'=>8,'xingxiu'=>'斗宿'), 24=>array('id'=>10,'xingxiu'=>'女宿'), 25=>array('id'=>11,'xingxiu'=>'虚宿'), 26=>array('id'=>12,'xingxiu'=>'危宿'), ); $num = 0; for($i=1;$i<13;$i++){ for($j=1;$j<31;$j++){ if(($num%30==0&&$j==1)&&$i==2){ $num = $num-1; }else if(($num+$i-2)%30==0&&$j==1&&$i>2&&$i<7){ $num = $num-1; }else if(($num+$i-4)%30==0&&$j==1&&$i>8&&$i<11){ $num = $num-1; }else if(($num+$i-5)%30==0&&$j==1&&$i>11){ $num = $num-1; } $xingxiu[$i][$j]['id'] = $xx[$num%27]['id']; $xingxiu[$i][$j]['xingxiu'] = $xx[$num%27]['xingxiu']; $num++; } } export_to_file($file,$xingxiu);//<a target=_blank target="_blank" href="http://blog.csdn.net/hearain528/article/details/40144427">该函数见上一篇博客</a>
时间: 2024-10-09 16:10:44