git设置忽略列表
在项目根目录新建.gitignore文件
/Application/Runtime/*
/DEMO/*
在项目根目录新建.gitignore文件
/Application/Runtime/*
/DEMO/*
例如:
<?php
$a=array("Cat","Dog","Horse","Dog");
print_r(array_count_values($a));
?>
输出:
Array ( [Cat] => 1 [Dog] => 2 [Horse] => 1 )
<?php
//去除值为"Cat"的元素
$a=array("a"=>"Dog","b"=>"Cat","c"=>"Horse");
print_r($a);
unset($a[array_search("Cat",$a)]);//array_search("Cat",$a)按元素值返回键名。去除后保持索引
print_r($a);
//或
$arr = array();
foreach ($a as $key=>$value){
if ($value != 'Cat') $arr[] = $value;
}
var_dump($arr);
?>
显示结果
//去除前:
Array (
[a] => Dog
[b] => Cat
[c] => Horse
)
//去除后:
Array (
[a] => Dog
[c] => Horse
)
新建个.sh文件 (sfcq、cqsf、zhaosf...是目录名)
#!/bin/sh
#comments
find /home/wwwroot/ -name sfcq | xargs rm -rf
find /home/wwwroot/ -name cqsf | xargs rm -rf
find /home/wwwroot/ -name zhaosf | xargs rm -rf
find /home/wwwroot/ -name kaisf | xargs rm -rf
find /home/wwwroot/ -name haosf | xargs rm -rf
find /home/wwwroot/ -name qusf | xargs rm -rf
find /home/wwwroot/ -name kage | xargs rm -rf
find /home/wwwroot/ -name apage | xargs rm -rf
find /home/wwwroot/ -name wansf | xargs rm -rf
添加个Crontab任务,OK
比起这种方法更建议大家去做好服务器安全~
HTML:
<div id="box" style="width:200px;height:200px;border:1px solid;" contenteditable></div>
<script>
document.querySelector('#box').addEventListener('paste', function(e) {
// chrome
if (e.clipboardData && e.clipboardData.items[0].type.indexOf('image') > -1) {
var that = this,
reader = new FileReader();
file = e.clipboardData.items[0].getAsFile();
reader.onload = function(e) {
var xhr = new XMLHttpRequest(),
fd = new FormData();
xhr.open('POST', '../upload.php', true);
xhr.onload = function () {
var img = new Image();
img.src = xhr.responseText;
that.appendChild(img); // 这里是把上传后得到的地址插入到#box里
}
fd.append('file', this.result); // this.result得到图片的base64
xhr.send(fd);
}
reader.readAsDataURL(file);
}
}, false);
</script>
PHP:
<?php
header("Access-Control-Allow-Origin:*");
$url = 'http://'.$_SERVER['HTTP_HOST'];
$file = $_POST["file"];
$data = base64_decode(str_replace('data:image/png;base64,', '', $file)); //截图得到的只能是png格式图片,所以只要处理png就行了
$name = md5(time()) . '.png'; // 这里把文件名做了md5处理
file_put_contents($name, $data);
echo "$url/$name";
?>
//桌面提醒
function notify(title, content) {
if(!title && !content){
title = "桌面提醒";
content = "您看到此条信息桌面提醒设置成功";
}
var iconUrl = "/images/send_ok.png";
if (window.webkitNotifications) {
//chrome老版本
if (window.webkitNotifications.checkPermission() == 0) {
var notif = window.webkitNotifications.createNotification(iconUrl, title, content);
notif.display = function() {}
notif.onerror = function() {}
notif.onclose = function() {}
notif.onclick = function() {this.cancel();}
notif.replaceId = 'Meteoric';
notif.show();
} else {
window.webkitNotifications.requestPermission($jy.notify);
}
}
else if("Notification" in window){
// 判断是否有权限
if (Notification.permission === "granted") {
var notification = new Notification(title, {
"icon": iconUrl,
"body": content,
});
}
//如果没权限,则请求权限
else if (Notification.permission !== 'denied') {
Notification.requestPermission(function(permission) {
// Whatever the user answers, we make sure we store the
// information
if (!('permission' in Notification)) {
Notification.permission = permission;
}
//如果接受请求
if (permission === "granted") {
var notification = new Notification(title, {
"icon": iconUrl,
"body": content,
});
}
});
}
}
}
ps: Chrome需在服务器环境测试
转自:http://blog.csdn.net/qzmrock/article/details/39802391
1、检测Internet Explorer版本
当涉及到CSS
设计时,对开发者和设计者而言Internet Explorer
一直是个问题。尽管IE6的黑暗时代已经过去,IE也越来越不流行,它始终是一个能够容易检测的好东西。当然了,下面的代码也能用于检测别的浏览器。
$(document).ready(function() {
if (navigator.userAgent.match(/msie/i) ){
alert('I am an old fashioned Internet Explorer');
}
});
2、平稳滑动到页面顶部
这是一个最广泛使用的jQuery
效果:对一个链接点击下会平稳地将页面移动到顶部。这里没什么新的内容,但是每个开发者必须要会偶尔编写一下类似函数
$("a[href='#top']").click(function() {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});