终于开学了
2010年2月28日
没有评论
终于开学了哈. 可以上网了。 最后的半学期,努力。
分类: 随便写写
合并数组有三个函数:
1.array_combine()
携带两个参数数组,参数数组一的值作新数组的键,参数数组二的值作新数组的值。很简单。
例子:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | < ?php $a = array('green', 'red', 'yellow'); $b = array('avocado', 'apple', 'banana'); $c = array_combine($a, $b); print_r($c); ?> < ?php $a = array('green', 'red', 'yellow'); $b = array('avocado', 'apple', 'banana'); $c = array_combine($a, $b); print_r($c); ?> |
上例将输出:
1 2 3 4 5 6 7 8 9 10 11 12 | Array ( [green] => avocado [red] => apple [yellow] => banana ) Array ( [green] => avocado [red] => apple [yellow] => banana ) |
尊敬的客户 ***, 您好:
国内严打之风盛行, 因机房的整体IP段被封网, 我司在有合法牌照的情况下, 主机被强制中断80端口的访问.
国家相关部门给出答复3月底才能审查结束, 相信各位站长都不能等漫长的封网, 我司只能另购香港空间, 让大家免费迁移到自由的环境.
哎,要不是今天抽空上次网,我被封了都不知道, 本来在家就不方便,还得把FTP 备份 转移了, 哎。 真麻烦。
最近有个小系统要绘制统计图,没有做过,网上找了几个类试了下,没有很合适的,open-flash-chart 很好,但是对于我这新手来说还是比较复杂的,例子也少。正好以前买的本书《大道PHP》 上第29章有一讲是 用Jpgraph 画图的。挺简单的,输入数据就能出图, 看了下例子,拿来用用(最简单的)。
系统还没有做完,先把简单的统计图弄上来。 访问地址
要过年了,在家也不能上网,祝大家新年快乐哦。 ^_^
关键代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | include("config.php"); include("include/jpgraph.php"); include("include/jpgraph_line.php"); //创建背景图像 $resultNum=mysql_query("select * from down_flow "); //将查询结果设为X坐标和Y坐标显示的数据 $i=0; while($it=mysql_fetch_array($resultNum)){ $datay[$i]=(int)$it['flow2']; $datax[$i]=(int)$it['hour']; $i++; } $graph=new Graph(820,490); //设置刻度样式 $graph->SetScale("intint"); //$graph->SetScale("textint",1000,9500,1,24); //设置边界范围 $graph->img->SetMargin(40,30,60,10); //设置标题 $graph->title->Set("统计图"); // 设置中文字体 $graph->title->setFont(FF_SIMSUN,FS_BOLD); //定义曲线图 $lineplot=new LinePlot($datay,$datax); //改变曲线图颜色为蓝色 $lineplot->SetColor("blue"); //设置曲线的图例 $lineplot->SetLegend("dataFlow"); $lineplot->setFont(FF_SIMSUN,FS_BOLD); //将曲线图加入背景图像中 $graph->Add($lineplot); //将X-Y坐标图输出 $graph->Stroke(); ?> |
Recent Comments