nginx 编译参数:
--prefix=/etc/nginx --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.39 --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --conf-path=/etc/nginx/nginx.conf --http-uwsgi-temp-path=/etc/nginx/uwsgi_params --http-fastcgi-temp-path=/etc/nginx/fastcgi_params --http-scgi-temp-path=/etc/nginx/scgi_params --with-http_v2_module --with-http_stub_status_module --with-http_gzip_static_module --with-ipv6 --with-openssl=/usr/local/src/openssl-1.1.0g
这是正确的,在这个基础上加上下面的add modules
--add-module=/usr/local/src/lua-nginx-module-0.10.10 --add-module=/usr/local/src/ngx_devel_kit-0.3.0
configure是可以的,make 就出错了。错误如下:
/usr/local/src/lua-nginx-module-0.10.10/src/ngx_http_lua_module.c: In function ‘ngx_http_lua_merge_srv_conf’:
/usr/local/src/lua-nginx-module-0.10.10/src/ngx_http_lua_module.c:1022:37: error: passing argument 2 of ‘SSL_CTX_sess_set_get_cb’ from incompatible pointer type [-Werror]
ngx_http_lua_ssl_sess_fetch_handler);
^
In file included from src/event/ngx_event_openssl.h:15:0,
from src/core/ngx_core.h:83,
from /usr/local/src/lua-nginx-module-0.10.10/src/ddebug.h:13,
from /usr/local/src/lua-nginx-module-0.10.10/src/ngx_http_lua_module.c:11:
/usr/local/src/openssl-1.1.0g/.openssl/include/openssl/ssl.h:639:6: note: expected ‘struct SSL_SESSION * (*)(struct ssl_st *, const unsigned char *, int, int *)’ but argument is of type ‘struct SSL_SESSION * (*)(struct SSL *, u_char *, int, int *)’
void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
^
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/src/ngx_http_lua_module.o] 错误 1
make[1]: *** 正在等待未完成的任务....
make[1]:正在离开目录 `/usr/local/src/nginx-1.10.3'
make: *** [build] 错误 2
确切地说,想OP要求一个函数来检索特定对象的构造函数名称。在Javascript方面,object没有一个类型,但是是一种类型的和本身。但是,不同的对象可以有不同的构造函数。
Object.prototype.getConstructorName = function () {
var str = (this.prototype ? this.prototype.constructor : this.constructor).toString();
var cname = str.match(/function\s(\w*)/)[1];
var aliases = ["", "anonymous", "Anonymous"];
return aliases.indexOf(cname) > -1 ? "Function" : cname;
}
new Array().getConstructorName(); // returns "Array"
(function () {})().getConstructorName(); // returns "Function
我是这么用的,使用一个小技巧:
function Square(){
this.className = "Square";
this.corners = 4;
}
var MySquare = new Square();
console.log(MySquare.className); // "Square"