realfilesarr=(123 456 789)
function contains() {
local n=$#
local value=${!n}
for ((i=1;i < $#;i++)) {
if [ "${!i}" == "${value}" ]; then
echo "y"
return 0
fi
}
echo "n"
return 1
}
if [ $(contains "${realfilesarr[@]}" "123") == "n" ]; then
echo "不存在";
fi
if [ $contains "${realfilesarr[@]}" "123") == "y" ]; then
echo "存在";
fi
X-Frame-Options 响应头
X-Frame-Options HTTP 响应头是用来给浏览器指示允许一个页面可否在 <frame>, <iframe>或者 <object> 中展现的标记。网站可以使用此功能,来确保自己网站的内容没有被嵌到别人的网站中去,也从而避免了点击劫持 (clickjacking) 的攻击。
X-Frame-Options 有三个值:
DENY- 表示该页面不允许在 frame 中展示,即便是在相同域名的页面中嵌套也不允许。
SAMEORIGIN- 表示该页面可以在相同域名页面的 frame 中展示。
ALLOW-FROM uri- 表示该页面可以在指定来源的 frame 中展示。
换一句话说,如果设置为 DENY,不光在别人的网站 frame 嵌入时会无法加载,在同域名页面中同样会无法加载。另一方面,如果设置为 SAMEORIGIN,那么页面就可以在同域名页面的 frame 中嵌套。
https://developer.mozilla.org/zh-CN/docs/Web/HTTP/X-Frame-Options
使用openssl_encrypt 替换 mcrypt_encrypt
自己摸索出来的:
# $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->key, $input, MCRYPT_MODE_CBC, $iv);
$encrypted = openssl_encrypt($input, ‘AES-128-CBC’, $this->key, OPENSSL_RAW_DATA, $iv);
网上看到的,很好的方案:https://gist.github.com/odan/c1dc2798ef9cedb9fedd09cdfe6e8e76
cookie 之 httponly、secure 、domain、path 坑
httponly 开启会导致js无法读取
secure 如果你混用https和http开启后有坑
domain 没啥说的,就有有继承关系,一不小心cookie就有两份啊
path 一般用 / 就好了 不要用空。
Predis重要参数:persistent
persistent [boolean – default: false]
Specifies if the underlying connection resource should be left open when a script ends its lifecycle.
使用效果:连接数降低10倍以上
SQLSTATE[HY000] [2831] Failed For Wait Mysql Server Handshake, please check the health of db
$.getScript原生实现
var script = document.createElement(‘script’);
script.type = ‘text/javascript’;
script.src = ‘/xxx.js’; //填自己的js路径
document.body.appendChild(script);// 缺点:不能跨域load
# 方法2
(function(){
var i = document.createElement(‘iframe’);
i.style.display = ‘none’;
// i.onload = function() {i.parentNode.removeChild(i);};
// i.name=”;
i.src = ‘http://xxx/xx’;
document.body.appendChild(i);
// i.contentWindow.document.body.innerHTML = ”;
})();
nginx代理转发之,丢失的cookie处理
| Syntax: | proxy_cookie_path off;proxy_cookie_path path replacement; |
|---|---|
| Default: |
proxy_cookie_path off; |
| Context: | http, server, location |
This directive appeared in version 1.1.15.
upstream timed out (110: Connection timed out) while reading upstream
2018/04/26 23:34:39 [error] 10872#0: *268906 upstream timed out (110: Connection timed out) while reading upstream, client: 119.103.223.107, server: ****, request: “GET /**** HTTP/1.1”, upstream: “****”, host: “****”
#fastcgi_connect_timeout 600;
#fastcgi_read_timeout 600;
#fastcgi_send_timeout 600;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
upstream timed out (110: Connection timed out) while reading upstream,
upstream timed out (110: Connection timed out) while reading response header from upstream
(24: Too many open files)
2018/04/26 23:32:58 [crit] 1457#0: *259351 open() “/usr/share/nginx/html/50x.html” failed (24: Too many open files), client: 112.17.247.117, server: ***, request: “GET /*** HTTP/1.1”, upstream: “***”, host: “***”
worker_rlimit_nofile 65535;