PHP - 传真格式判断
2017-07-23 •
评论
if(!preg_match("/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/", $fax)) {
exit(json_encode(array('code' => -1, 'info' => "传真格式错误")));
}
if(!preg_match("/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/", $fax)) {
exit(json_encode(array('code' => -1, 'info' => "传真格式错误")));
}
退出代码
<script>window.parent.location.href='/login';</script>
在登录页增加如下代码
<script>
if (window != top) {
top.location.href = location.href;
}
</script>
提交表单时报错:e[h] is not a function
原因:<button> 的 id 或 name 不可为 submit, 更名后即可。
public function indexAction() {
//获取父级代号pid
$pid = $this->getParam('pcode');
//数据查询
$areaModel = new Model_Area();
$fields = "*";
$whereArr[] = array('pid', $pid);
$areadetail = $areaModel->getArea($fields, $whereArr);
//var_dump($areadetail);
echo json_encode($areadetail);
}
<script type="text/javascript" src="//g.alicdn.com/dingding/open-develop/0.8.4/dingtalk.js"></script>
内部代码如下,作用是实现二维码的展现。
<script>
!function (window, document) {
function d(a) {
var e, c = document.createElement("iframe"),
d = "https://login.dingtalk.com/login/qrcode.htm?goto=" + a.goto ;
//console.log(d);
d += a.style ? "&style=" + encodeURIComponent(a.style) : "",
d += a.href ? "&href=" + a.href : "",
c.src = d,
c.frameBorder = "0",
c.allowTransparency = "true",
c.scrolling = "no",
c.width = a.width ? a.width + 'px' : "365px",
c.height = a.height ? a.height + 'px' : "400px",
e = document.getElementById(a.id),
e.innerHTML = "",
e.appendChild(c)
}
window.DDLogin = d
}(window, document);
</script>
$userinfo = json_decode($userinfo, true);
$count = json_decode(json_encode($count), true);
foreach($simplelist as $obj){
echo "姓名:".$obj->name." uerid:".$obj->userid."<br/>";
}
var ue = UE.getEditor('editor2', {
toolbars: [[
'source', '|', 'undo', 'redo', '|',
'bold', 'italic', 'underline', '|',
'selectall', 'cleardoc', '|',
'fontfamily', 'fontsize', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
'simpleupload', '|',
'removeformat', '|'
]],
iframeCssUrl: '../ueditor/themes/editor2.css',
initialFrameHeight:500,
enableAutoSave: false,
enableContextMenu: false,
elementPathEnabled : false,
focus:false,
autoHeightEnabled:false
});
var arr1 = new Array(3);
arr1[0] = "a";
arr1[1] = "b";
arr1[2] = "c";
arr1[3] = "d";
var arr2 = new Array(3);
arr2[0] = "x";
arr2[1] = "y";
arr2[2] = "z";
console.log(arr1);
console.log(arr2);
var length = arr1.length;
console.log(length);
var arr3 = new Array(3);
for(var j=0;j<length;j++){
var a = 2*j;
console.log(a);
var b = 2*j+1;
console.log(b);
arr3[a]=arr1[j];
arr3[b]=arr2[j];
}
console.log(arr3);
var str = arr3.join("");
console.log(str);
//axbyczd