kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

iframe弹窗--子页面


序号字段名显示中文名排序值选择
1ZGFL管理人员11111
2ZGFL高层管理22222
3ZGFL中层管理33333
4ZGFL基层管理44444
5ZGFL专业技术类55555
















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
<script>
function select_iframe(pre1, pid, pre2, sid, m)
{
	prr = pid.split(',');
	srr = sid.split(',');
	for (var i = 0; i < prr.length; i ++) {
		var ttype = parent.document.getElementById(pre1+'_'+prr[i]).type;
		if (ttype == 'select-one') {
			var ops = parent.document.getElementById(pre1+'_'+prr[i]).children;
			var html = document.getElementById(pre2+'_'+srr[i]).innerHTML;
			for (oi = 0; oi < ops.length; oi ++) {
				if (ops[oi].text == html) {
					// parent.document.getElementById(pre1+'_'+prr[i]).options[oi].selected = true;
					// ops[oi].selected = true;
				//    $(parent.document).find('#'+pre1+'_'+prr[i]).val(ops[oi].value).trigger('change');
					$('#'+pre1+'_'+prr[i], window.parent.document).val(ops[oi].value).trigger('change');
					var show_id = $('#select2-'+pre1+'_'+prr[i]+"-container", window.parent.document)[0];
					if (typeof(show_id) != "undefined") {
						show_id.title = ops[oi].text;
						show_id.innerText = ops[oi].text;
					}
					break;
				}
			}
		} else if (ttype == 'textarea') {
			parent.document.getElementById(pre1+'_'+prr[i]).innerHTML = document.getElementById(pre2+'_'+srr[i]).innerHTML;
			parent.document.getElementById(pre1+'_'+prr[i]).value = document.getElementById(pre2+'_'+srr[i]).innerHTML;
		} else {
			parent.document.getElementById(pre1+'_'+prr[i]).value = document.getElementById(pre2+'_'+srr[i]).innerHTML;
		}
	}
	if (m == '2') {
		parent.document.getElementById("popup").style.display = "none";
	}
}
</script>

<br>

<table border='1' style="border-collapse: collapse;" table-layout='fixed' id='tb_zzdmk_98' width='98%' >
<thead>
<tr>
	<th>序号</th><th>字段名</th><th>显示中文名</th><th>排序值</th><th>选择</th>
</tr>
</thead>
<tr ondblclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_668', 'zwm,sortid', '2')" ><td>1</td><td id='zzdmk_668_pbf'>ZGFL</td><td id='zzdmk_668_zwm'>管理人员</td><td id='zzdmk_668_sortid'>11111</td><td><input style='width:70%;height:70%;' type='radio' name='radio_iframe' onclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_668', 'zwm,sortid', '1')"></td></tr>
<tr ondblclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_669', 'zwm,sortid', '2')" ><td>2</td><td id='zzdmk_669_pbf'>ZGFL</td><td id='zzdmk_669_zwm'>高层管理</td><td id='zzdmk_669_sortid'>22222</td><td><input style='width:70%;height:70%;' type='radio' name='radio_iframe' onclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_669', 'zwm,sortid', '1')"></td></tr>
<tr ondblclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_670', 'zwm,sortid', '2')" ><td>3</td><td id='zzdmk_670_pbf'>ZGFL</td><td id='zzdmk_670_zwm'>中层管理</td><td id='zzdmk_670_sortid'>33333</td><td><input style='width:70%;height:70%;' type='radio' name='radio_iframe' onclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_670', 'zwm,sortid', '1')"></td></tr>
<tr ondblclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_671', 'zwm,sortid', '2')" ><td>4</td><td id='zzdmk_671_pbf'>ZGFL</td><td id='zzdmk_671_zwm'>基层管理</td><td id='zzdmk_671_sortid'>44444</td><td><input style='width:70%;height:70%;' type='radio' name='radio_iframe' onclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_671', 'zwm,sortid', '1')"></td></tr>
<tr ondblclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_672', 'zwm,sortid', '2')" ><td>5</td><td id='zzdmk_672_pbf'>ZGFL</td><td id='zzdmk_672_zwm'>专业技术类</td><td id='zzdmk_672_sortid'>55555</td><td><input style='width:70%;height:70%;' type='radio' name='radio_iframe' onclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_672', 'zwm,sortid', '1')"></td></tr>
</table>


<script> parent.document.getElementById('popup').style.display = 'block'; </script>

iframe弹窗--主页面


       
















https://www.yzktw.com.cn/post/1554566.html

https://blog.51cto.com/u_16070335/6189297

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
<style type='text/css'>
.popup {
	display: none;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 70%;
	height: 60%;
	background-color: #E8E8E8;
	padding: 20px;
	border-radius: 10px;
	box-shadow: 0px 0px 20px rgba(0,0,0,0.5);
}

.popup .close-btn {
	position: absolute;
	top: 10px;
	right: 20px;
	font-size: 20px;
	color: black;
	cursor: pointer;
}
</style>

<div class="popup" id="popup" style='z-index:99;display:none;'>
<span class="close-btn">X</span>
<iframe id='n_iframe' src='' style='width:96%;height:100%; border: 1px solid #E8E8E8;'>
</iframe>
</div>

<script>
var closeBtn = document.querySelector(".close-btn");
closeBtn.addEventListener("click", function() {
	popup.style.display = "none";
	document.getElementById('n_iframe').src = '';
});

var popup = document.getElementById("popup");
function popup_it(url)
{
	window.frames[0].location.href = url;
	//popup.style.display = "block"; // 在子页面显示更好
}
</script>

<center>
<br>
<input style='width:150px;' name='zzfl_id_zgfl' id='zzfl_id_zgfl' value='显示中文名'>   
<input style='width:100px;' name='zzfl_id_sortid' id='zzfl_id_sortid' value='排序值'>   
<button class='submit' type='button' id='popup_b' onclick="popup_it('/blog/2023/10/21/lang-web-popup-2/')">弹窗选择</button>

</center>

php判断客户端是否是微信内置客户端

https://www.cnblogs.com/caicaizi/p/5629190.html

微信内置浏览器的渲染方式在某些方面和其他浏览器不同,所以有时候需要做一些兼容性处理,那么就需要判断是否是微信内置浏览器。最好的判断方式就是通过 User Agent 来判断。

在iPhone下,返回

1
Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B176 MicroMessenger/4.3.2

在Android下,返回

1
Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255

不难发现微信浏览器为 MicroMessenger ,并且有版本号,也可以判断手机类型为iPhone还是Android

1
2
3
4
5
6
7
function is_weixin()
{
	if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
		return true;
	}
	return false;
}