admin 发布的文章

var globalEval = eval;     //定义全局eval函数别名
    var a ="global", b = "global";    //全局变量
    function c(){
      var a = "local";      //局部变量
      eval('a+="changed"');  //直接更改局部变量的值
      return a;      //返回更改后的局部变量
    }
    function d(){
      var b = "local";
      globalEval("b+='changed'");
      return b;
    } 
    console.log(c(), a); //localchanged       global
    console.log(d() , b) //local              globalchanged

相关文章:https://blog.csdn.net/wangqing84411433/article/details/70197523

1. 保存文件为GB2312编码

Function 保存文件(文件,内容)
    Set Fs = CreateObject("Scripting.FileSystemObject")    '仅支持GB2312 
    Set File = Fs.OpenTextFile(文件,2,True)    '2覆盖,8追加; True文件不存在则自动创建.Flase不自动创建 
    File.writeline 内容    'file.writeline 会写入换行符,file.write 不会写入换行符 
    File.Close 
End Function

2. 自定义保存文件编码

Function 保存附件(文件,内容,编码)
    dim fxt,txt
    set Astream=CreateObject("Adodb.Stream")
    fxt=mid(文件,InStrRev(文件,".")+1)
    txt=false
    if fxt="asp" or fxt="xml" or fxt="aspx" or fxt="php" or fxt="txt" or fxt="jsp" or fxt="htm" or fxt="html" or fxt="js" then
        txt=true
    end if
    if txt then
        Astream.type=2  '1 bin,2 txt
    else
        Astream.type=1  '1 bin,2 txt
    end if
    Astream.Mode = 3'     adModeRead =1 
    '  adModeReadWrite =3 
    '  adModeRecursive =4194304 
    '  adModeShareDenyNone =16 
    '  adModeShareDenyRead =4 
    '  adModeShareDenyWrite =8 
    '  adModeShareExclusive =12 
    '  adModeUnknown =0 
    '  adModeWrite =2 
    Astream.open
    'Astream.CharSet = "GB2312"
    'Astream.LoadFromFile(文件) '装载文件
    'Assp=Astream.size
    Astream.Position =0 '装载文件时设置为Assp
    'Astream.Writetext 内容,1
    if txt then
        '内容=BytesToStr(内容)
        Astream.CharSet =编码 '  "GB2312","UTF-8"
        Astream.Writetext 内容,1
        'Astream.CharSet = "GB2312"
    else
        Astream.Write 内容
    end if
    'msgbox 文件
    Astream.SaveToFile 文件,2
    ' "F:\temp\a.jpg",2 
    Astream.close
    set Astream=Nothing
End Funcion

相关文章:
https://blog.csdn.net/jessezappy/article/details/102578022

首先需求是这样的:需要根据用户输入的域名或IP(内网或外网)来加载不同的静态资源。

之前功能是好的,最近使用了iis做反向代理发现获取到的是服务器的IP,排查了好久才找到原因出在反向代理上:

  • 代理为了提高性能,一些Http头部信息不回转发给后台服务器,其中就包括代理服务器的host信息,而tomcat中对于request.getServerName()的实现,就是取这个host信息,如果http
    header总没设置,则取应用所在服务器IP地址。

所以,需要设置下让代理服务器把Host转发给后台服务器。网上类似的资料都是apache和nginx的解决方法,iis的资料很少,搜了好久才找到,这里总结下:

1、apache:在<VirtualHost/>标签中的最后添加 ProxyPreserveHost on

<VirtualHost *:80>
    RewriteEngine on
    ProxyPass /TLimages/ !
    ProxyPass /imagelist/ !
    ProxyPass /xiazai/ !
    ProxyPass /ad/ !
    ProxyPass / balancer://proxy/
    ProxyPassReverse / balancer://proxy/
    ProxyPreserveHost on
</VirtualHost>

2、nginx:在location {…}中添加 proxy_set_header Host $host

location ^~/proxy_path/ {
    root "/www/html";
    index index.html;
    proxy_pass http://192.168.223.137/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

3、iis:设置preserveHostHeader:true

%windir%\system32\inetsrv\appcm d.exe set config -section:system.webServer/proxy -preserveHostHeader:true /commit:apphost

相关文章:http://www.yyjjssnn.cn/articles/842.html

调试用的

log_format json  '{'
        '"time_local":"$time_local",'
        '"time_iso8601":"$time_iso8601",'
        '"host":"$host",'
        '"remote_addr":"$remote_addr",'
        '"http_x_forwarded_for":"$http_x_forwarded_for",'
        # $remote_user等同于用户名,由ngx_http_auth_basic_module认证
        '"remote_user":"$remote_user",'
        # 客户端port
        '"remote_port":"$remote_port",'
        '"request":"$request",'
        # 含有参数的完整的初始URI
        '"request_uri":"$request_uri",'
        # $query_string与$args一样
        '"args":"$args",'
        '"query_string":"$query_string",'
        '"status":"$status",'
        # 协议,通常是“GET”或“POST”
        '"request_method":"$request_method",'
        '"server_protocol":"$server_protocol",'
        '"request_body":"$request_body",'
        # 当前请求的文件的路径名,由root或alias和URI request组合而成
        '"request_filename":"$request_filename",'
        '"body_bytes_sent":"$body_bytes_sent",'
        '"http_referer":"$http_referer",'
        '"http_user_agent":"$http_user_agent",'
        '"upstream_addr":"$upstream_addr",'
        '"upstream_response_time":"$upstream_response_time",'
        '"upstream_status":"$upstream_status",'
        '"request_time":"$request_time",'
        '"cookie_uid":"$cookie_uid"'
        '}';

loghao 记录下来以后用

    log_format  loghao  '[$time_local] - $remote_user $http_x_forwarded_for - $host$request_uri $status $request_method $server_protocol $body_bytes_sent '
        '"$http_referer" "$request_body" "$http_user_agent" "$request_filename" '
        '"$upstream_addr" "$upstream_response_time" "$upstream_status" $request_time';

相关文章:
http://www.hebinghua.com/linux/25.html

apache 配置:

<Directory "/">
  AuthType "Basic"
  AuthName "Password Required" #提示文字
  AuthUserFile "D:\wwwroot\sites\pass.txt" #加密密码的文件
  Require valid-user
</Directory>

生成加密密码文件:

D:\apache\bin\htpasswd.exe -cmdps D:\pass.txt admin
Warning: CRYPT algorithm not supported on this platform.
Automatically using MD5 format.
New password: *****
Re-type new password: *****
Adding password for user admin

相关文章:https://blog.csdn.net/weixin_34256074/article/details/94087380