用Windows自带的netsh实现端口映射命令
安装(如果已经安装IPV6则不需要)
netsh interface ipv6 install
增加端口映射
将192.168.1.10的11111映射到192.168.1.11的80端口,可以不指定listenaddress本地监听地址,如果系统启用了防火墙,需要放行TCP对应端口的入站连接
netsh interface portproxy add v4tov4 listenport=11111 listenaddress=192.168.1.10 connectport=80 connectaddress=192.168.1.11
...asp与php常用函数对照表
asp(vbs)常用函数30个 | PHP类似函数 |
trim( ) | trim( ) |
replace( ) | str_replace( ) // str_ireplace( ) |
split( ) | explode( ) |
ubound( ) | count( ) |
isNull( ) | is_null( ) empty( ) 0,””,Null,False,空属性对象都将返回false |
isEmpty( ) | empty( ) 同上 isset( ) 是否已初始化 |
isNumeric( ) | is_numeric( ) |
instr( ) instrRev( ) | strpos( ) // stripos( ) strrpos( ) // strripos( ) |
mid( ) | substr( ) |
left( ) right( ) | 无对应函数 |
len( ) | strlen( ) |
cint( ) | intval( ) |
cstr( ) | strval( ) |
now( ) 当前日期+时间 date( ) 当前日期 year( ) month( ) day( ) | date (“Y-m-d H:i:s”) date(“Y-m-d”) date(“Y”) date(“m”) date(“d”) 详细请参见补充8中日期函数表 |
timer( ) | microtime( ) |
datediff( ) | 无对应内置函数,类似自定义函数如下 function DateDiff($date1,$date2,$unit="d"){ switch ($unit) { case 's': $dividend = 1; break; case 'i': $dividend = 60; break; case 'h': $dividend = 60*60; break; case 'd': $dividend = 60*60*24; break; case 'm': $dividend = 60*60*24*30; break; case 'y': $dividend = 60*60*24*365; break; default: $dividend = 60*60*24; } $time1 = strtotime($date1); $time2 = strtotime($date2); if ($time1 && $time2){ return ceil(($time1 - $time2) / $dividend); }else{ return false; } } 使用: |
nginx相关的正则匹配
~ 匹配,区分大小写
~* 不区分大小写的匹配
!~ 不匹配
!~* 不匹配
^~ 常用于location 语法中,后边是一个字符串。它的意思是,在这个字符串匹配后停止进行正则表达式的匹配。
如: location ^~ /images/,你希望对/images/这个目录进行一些特别的操作,如增加expires头,防盗链等,但是你又想把除了这个目录的图片外的所有图片只进行增加expires头的操作,这个操作可能会用到另外一个location,例如:location ~* \.(gif|jpg|jpeg)$,这样,如果有请求/images/1.jpg,nginx如何决定去进行哪个location中的操作呢?结果取决于标识符^~,如果你这样写:location /images/,这样nginx会将1.jpg匹配到location ~* \.(gif|jpg|jpeg)$这个location中,这并不是你需要的结果,而增加了^~这个标识符后,它在匹配了/images/这个字符串后就停止搜索其它带正则的location。
= 表示精确的查找地址,如location = /它只会匹配uri为/的请求,如果请求为/index.html,将查找另外的location,而不会匹配这个,当然可以写两个location,location = /和location /,这样/index.html将匹配到后者,如果你的站点对/的请求量较大,可以使用这个方法来加快请求的响应速度。
@ 表示为一个location进行命名,即自定义一个location,这个location不能被外界所访问,只能用于Nginx产生的子请求,主要为error_page和try_files。