This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//遍历指定目录的文件夹及其子文件夹 | |
/* | |
* @param1 string $dir,要遍历的文件夹 | |
* @param2 int $level,当前遍历的文件夹的深度,默认为0,表示第一层 | |
* | |
* @return array $arr,一个遍历好的数组 | |
*/ | |
function get_dir($dir,$level = 0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http请求 | |
http请求分为四个部分 | |
请求行:包含三个内容 | |
请求方式:GET/POST | |
URI:要请求的文件路径 | |
协议版本:HTTP/1.1 | |
请求头:请求头就是一项一项的规范(协议的真正内容),一个内容占一行 | |
host:所请求的主机地址 | |
accept-encoding:可以接受 的数据的编码,是什么流文件(文件内容) | |
referer:引用,指从哪个界面过来的(跳转过来) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var starttime = new Date("2017/11/20"); | |
setInterval(function () { | |
var nowtime = new Date(); | |
var time = starttime - nowtime; | |
var day = parseInt(time / 1000 / 60 / 60 / 24); | |
var hour = parseInt(time / 1000 / 60 / 60 % 24); | |
var minute = parseInt(time / 1000 / 60 % 60); | |
var seconds = parseInt(time / 1000 % 60); | |
$('.timespan').html(day + "天" + hour + "小时" + minute + "分钟" + seconds + "秒"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file_get_contents() 来获取API里提供的数据时,出现错误,使用的代码是这样的: | |
<?php | |
$data = file_get_contents(".firebaseio.com/v0/topstories.json?print=pretty"); | |
...... | |
当运行上面的代码是遇到下面的错误提示: | |
PHP Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? | |
下面是截图: | |
为什么会出现这样的错误? | |
在网上经过一番搜索,发现遇到这样错误的人还不少,问题很直接,是因为在PHP的配置文件里没有开启一个参数,在我本机上是 /apache/bin/php.ini 里的;extension=php_openssl.dll 这一项,需要将前面的分号去掉。你可以用下面的脚本来检查你的PHP环境的配置: | |
$w = stream_get_wrappers(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install nano -y; yum update -y; yum upgrade -y; yum install tigervnc-server -y; yum groupinstall "Desktop" -y; yum install firefox -y; rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm; rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux; yum install flash-plugin nspluginwrapper alsa-plugins-pulseaudio libcurl -y; echo 'echo "nameserver 8.8.8.8" >> /etc/resolv.conf; ' >> /etc/rc.local; echo 'VNCSERVERS="1:root"' >> /etc/sysconfig/vncservers; echo 'VNCSERVERARGS[1]="-geometry 1000x700"' >> /etc/sysconfig/vncservers; vncpasswd; chkconfig vncserver on --level 345; reboot; | |
//安装word文档工具 | |
yum install libreoffice | |
//安装中文语言 | |
yum groupinstall "Chinese Support" | |
vi /etc/sysconfig/i18n | |
//把LANG=”XXXXX”内容替换成LANG=”zh_CN.UTF-8 | |
//清除防火墙规则 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget https://raw.githubusercontent.com/kuoruan/shell-scripts/master/ovz-bbr/ovz-bbr-installer.sh | |
chmod +x ovz-bbr-installer.sh | |
./ovz-bbr-installer.sh | |
需要配置的有如下几个选项: | |
1.需要加速的端口,即 SS 端口。加速开启之后,流量会先经过 BBR 处理,之后再发送给后端的 SS。 | |
2.可能需要配置 “公网接口名称”,即你服务器上具有公网 IP 的接口名称。搬瓦工 OpenVZ 上默认都是 venet0,但是有朋友可能需要安装在其他服务器上,所以我加入了此选项。 | |
需要注意的是,在有 firewalld 的服务器上安装的时候,firewalld 会干扰 iptables 的规则,造成网络不通(现在具体原因未知,谁有解决方案可以提示一下)。所以在装有 firewalld 的服务器上需要先退出 firewalld: | |
这个步骤搬瓦工不需要配置 | |
systemctl stop firewalld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//man手册 | |
man 1 sleep #man是按照手册的章节1号的sleep命名,2系统编程,3.C语言编程 | |
//jobs | |
查看后台运行程序 | |
//ctrl+z可以将在运行的程序调入后台运行 | |
//fg将后台程序调出前台 | |
fg 编号 #编号 通过jobs查看 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
更新指定的 rpm 包,如更新 kernel 和 kernel source | |
# yum update kernel kernel-source | |
大规模的版本升级,与 yum update 不同的是,连旧的淘汰的包也升级 | |
# yum upgrade | |
// yum 安装 gcc 编译环境,为编译 lnmp 做准备 | |
yum install gcc automake autoconf libtool gcc-c++ | |
//安装memcached后运行文件出现can't run as root without the -u switch | |
可以./memcached -u nobody |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uname -r 3.10.0-327.el7.x86_64 | |
yum -y install docker | |
yum update | |
service docker start | |
docker run hello-world | |
由于本地没有hello-world这个镜像,所以会下载一个hello-world的镜像,并在容器内运行。 | |
sudo yum update | |
==========================================ubuntu 14.04安装docker====================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table it_admin( | |
id int primary key auto_increment, | |
username varchar(32) not null default '' comment "用户名", | |
password char(32) not null default '' comment "用户密码", | |
salt varchar(32) not null default '' comment "辅助密码一个字符串", | |
role_id int not null default 0 comment '用户所属角色id' | |
)engine myisam charset utf8; | |
create table it_role( | |
id int primary key auto_increment, |
OlderNewer