PHP流程控制之goto语句

goto 操作符可以用来跳转到程序中的另一位置。该目标位置可以用目标名称加上冒号来标记,而跳转指令是 goto 之后接上目标位置的标记。PHP 中的 goto 有一定限制,目标位置只能位于同一个文件和作用域,也就是说无法跳出一个函数或类方法,也无法跳入到另一个函数。也无法跳入到任何循环或者 switch 结构中。可以跳出循环或者 switch,通常的用法是用 goto 代替多层的 break。

Read More

PHP中break及continue两个流程控制指令解析

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
41
<?php
$arr = array(
'a' => '0a0',
'b' => '0b0',
'c' => '0c0',
'd' => '0d0',
'e' => '0e0',
);
//********break********//
//用来跳出目前执行的循环,并不再继续执行循环了。
foreach($arr as $k => $v){
if($k == 'c'){
break;
}
$arr2[$k] = $v;
}
var_dump($arr2);
/*
array (size=2)
'a' => string '0a0' (length=3)
'b' => string '0b0' (length=3)
*/

//********continue********//
//立即停止目前执行循环,并回到循环的条件判断处,继续下一个循环。
foreach($arr as $k => $v){
if($k == 'c'){ //忽略对这一项的处理
continue;
}
$arr3[$k] = $v;
}
var_dump($arr3);
/*
array (size=4)
'a' => string '0a0' (length=3)
'b' => string '0b0' (length=3)
'd' => string '0d0' (length=3)
'e' => string '0e0' (length=3)
*/

?>

rockmongo配置文件config.php

使用编辑器(比如notepad或者VI/VIM命令)打开RockMongo安装目录下的config.php,所有的配置都在这里。

认证

mongo_auth 和control_auth

在开始使用RockMongo之前,你需要决定使用哪种校验方式。

如果mongo_auth被设成了true,用户必须使用MongoDB中的用户名和密码(由命令db.addUser()添加),所以配置中的mongo_user, mongo_pass和mongo_db就不再需要了,因为用户可以通过界面输入这些信息。

Read More

Highcharts属性与Y轴数据值刻度显示Y轴最小最大值

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
Highcharts.setOptions({global:{useUTC : false}});    
$(function(){
//声明报表对象
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container', // 报表显示在 页面位置 container 为 div 定义的属性
defaultSeriesType: 'spline', // 定义报表类型 例如:line ,spline ,colume
events: {
load: getForm //调用js 方法
}
},
title:{
text:'实时监测曲线图" //定义曲线报表 名称
},
xAxis: {
type: 'datetime', // 定义时间轴的 类型
maxPadding : 0.05,
minPadding : 0.05,
tickWidth:1,//刻度的宽度
lineWidth :1,//自定义x轴宽度
gridLineWidth :1,//默认是0,即在图上没有纵轴间隔线
lineColor : '#990000'
},
yAxis: {
max:12, // 定义Y轴 最大值
min:0, // 定义最小值
minPadding: 0.2,
maxPadding: 0.2,
tickInterval:1, // 刻度值
title: {
text: 'PH值'
},
// plotLines 表示为定义曲线报表中的 (刻度线)或者叫做(定义的区间范围)
// 一下为2条表示线
plotLines: [{
value: 6,
color: 'green',
dashStyle: 'shortdash',
width: 2,
label: {
text: '正常'
}
},{
value: 8,
color: 'green',
dashStyle: 'shortdash',
width: 2,
label: {
text: '正常'
}
}
}]
},
tooltip: { // 表示为 鼠标放在报表图中数据点上显示的数据信息
formatter: function() {
return '<b>'+'日期:' +'</b>'
+Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+
'<b>'+'<%=lbname%>:' +'</b>'+ this.y+' <%=shll%>';
}
},
series: [{
name: 'PH',
data: [] // 此处存放数据值 用,分开 例如:1.8,8.9,null,9.2, 如果在某一点数据为空
//可以用null 来表示
//如果是想动态扶植 这个位置 应该为空 即:data: []
}]
});
// 与后台进行数据交互
function getForm(){
jQuery.getJSON("test!test.do?id=123456", null, function(data) {
//为图表设置值
chart.series[0].setData(data);
});
}
//定时刷新 列表数据
$(document).ready(function() {
//每隔3秒自动调用方法,实现图表的实时更新
window.setInterval(getForm,50000);
});
});

//定义 曲线报表图 的样式
Highcharts.theme = {
colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655',
'#FFF263', '#6AF9C4'],
chart: {
backgroundColor: {
linearGradient: [0, 0, 500, 500],
stops: [
[0, 'rgb(255, 255, 255)'],
[1, 'rgb(240, 240, 255)']
]
},
borderWidth: 2,
plotBackgroundColor: 'rgba(255, 255, 255, .9)',
plotShadow: true,
plotBorderWidth: 1
},
title: {
style: {
color: '#000',
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif'
}
},
subtitle: {
style: {
color: '#666666',
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'
}
},
xAxis: {
gridLineWidth: 1,
lineColor: '#000',
tickColor: '#000',
labels: {
style: {
color: '#000',
font: '11px Trebuchet MS, Verdana, sans-serif'
}
},
title: {
style: {
color: '#333',
fontWeight: 'bold',
fontSize: '12px',
fontFamily: 'Trebuchet MS, Verdana, sans-serif'

}
}
},
yAxis: {
//minorTickInterval: 'auto' // 此处会在Y轴坐标2点之前出现小格 所以就没有使用。
},
legend: {
itemStyle: {
font: '9pt Trebuchet MS, Verdana, sans-serif',
color: 'black'
},
itemHoverStyle: {
color: '#039'
},
itemHiddenStyle: {
color: 'gray'
}
},
labels: {
style: {
color: '#99b'
}
}
};
var highchartsOptions = Highcharts.setOptions(Highcharts.theme);

Read More