强缓存与协商缓存概念:如何配置强缓存:server {listen 80; server_name tirion.me www.tirion.me; # note that these lines are originally from the "location /" block root /home/www/wordpress; index index.php index.html index.htm; location / { try_files $uri $uri/ =404; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fas
问题描述:数据库存储的时间字段类型为:timestamp数据库为:mysql的5.7.31现象:两个服务查询同一个字段,得出不同的结果。例:字段值为:2020-11-16 09:46:25,查询结果为:2020-11-16 23:46:25前提:使用的mysql驱动,一个为2.8.0.21,一个为2.5.1.37排查思路:首先怀疑是Calendar初始化的时候,Timezone不一致,追踪代码发现,Timezone初始化均使用jdk的路径判断,均为 Asia/Shanghai。// get the time zone ID from the system properties String zoneID = AccessController.doPrivileged( new GetPropertyAction("user.timezone")); // if the time zone ID is not set (yet), perform the // platform to Java time zone ID mapping. if (zoneID
起因:对接LinkedIn分享,领英要求页面需要在header中增加meta元素,标识出以下几种:操作步骤:页面是ajax异步请求的,再获取到数据之后,用js方法填充meta属性:$("meta[name='image']").attr('content', detail);问题来了:这样的页面查询元素的时候是有meta属性的,但是查询源代码却没有值原因:页面加载时,header的元素和dom元素优先加载,然后才会执行http请求,发生js填充事件。但是,网站源代码是指服务器源码,这一部分是不含js事件的。页面的审查元素是客户端代码,这部分并不是SEO、领英分享等功能需要的所以,修正方案:再跳转到具体页面的时候,就直接返回以上关键信息,加载dom元素的时候,使用赋值进去,就可以保证源代码也有meta标签了
URLDecoder.decode(param,"utf-8");有时候会出现类似如下的错误: URLDecoder异常Illegal hex characters in escape (%)这是因为传参有一些特殊字符,比如%号或者说+号,导致不能解析,报错解决方法是:public static String replacer(StringBuffer outBuffer) { String data = outBuffer.toString(); try { data = data.replaceAll("%(?![0-9a-fA-F]{2})", "%25"); data = data.replaceAll("\\+", "%2B"); data = URLDecoder.decode(data, "utf-8"); } catch (Exception e) { e.printStackTrace(); } return d
网上的改了半天都不好使。。最后发现的还用的方法是:tomcat版本:8.5.39解决办法:打开conf下logging.properties文件将带有utf-8的编码配置项注释掉,完美解决。1catalina.org.apache.juli.AsyncFileHandler.encoding = UTF-82localhost.org.apache.juli.AsyncFileHandler.encoding = UTF-83manager.org.apache.juli.AsyncFileHandler.encoding = UTF-84host-manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8java.util.logging.ConsoleHandler.encoding = UTF-8 其中java.util.logging.ConsoleHandler.encoding = UTF-8这一行是最关键的,只注释这一行也是可以的,上面那几行习惯性注释掉,不知道哪里用的。其实我只注释了最后一行。。
康叔的AI全栈工坊
Code for Life, AI for Future