博文

目前显示的是 十月, 2018的博文

Thinkphp压缩HTML,minify(兼容Windows和Linux)

因为自己搭建的网站是centos服务器,所以windows那套压缩html不好用,自己搜索找到了thinkphp压缩html的方法,可以兼容nginx和windows: 1、首先下载minify.class.php 下载地址:http://www.thinkphp.cn/code/download/id/355.html 这里注意修改代码如下,不然js会被吃掉         /**          * if (isset($javascript_mini))         {           preg_match_all('{<script.+</script>}msU', $output, $javascript_messed);           $output = str_replace($javascript_messed[0], $javascript_mini, $output);         }          */ 然后,把这个文件,放在Library/Think/下,记得修改命名空间 2、修改view.class.php代码,如下 if   ( C ( 'MINIFY' ))   { echo  Minify :: compress ( $content ); }   else   { echo $content ; } 注:最好的方法是将这里的render方法,添加一个参数,根据这个参数判断是否压缩。 不然所有页面都给压缩了,会有个问题。比如我需要个不需要压缩的xml文件,就无法实现。 3、添加配置文件 'MINIFY'   =>   true 然后刷新网页,任务完成 ...

mysql 批量替换表前缀方法

SELECT     CONCAT(         'ALTER TABLE ',         table_name,         ' RENAME TO i_',         substring(table_name, 4),         ';'     ) FROM     information_schema. TABLES WHERE     table_name LIKE 'yy%'; SELECT a.*, concat( 'alter table ', a.TABLE_NAME, ' rename ge_', SUBSTR( a.TABLE_NAME FROM INSTR(a.TABLE_NAME, '_') + 1 ), ';' ) FROM information_schema.`TABLES` a WHERE a.TABLE_SCHEMA = 'shiye';

外网访问腾讯云redis内网服务的方法

centos:6.* iptables 本机(192.168.1.7)的6198 转发到172.16.0.11的6379 [root@kvm-server conf]# iptables -t nat -A PREROUTING -p tcp -m tcp --dport 6198 -j DNAT --to-destination 172.16.0.11:6379 [root@kvm-server conf]# iptables -t nat -A POSTROUTING -d 172.16.0.11/32 -p tcp -m tcp --sport 6379 -j SNAT --to-source 192.168.1.7 [root@kvm-server conf]# iptables -t filter -A INPUT -p tcp -m state --state NEW -m tcp --dport 6198 -j ACCEPT centos:7.* firewall firewall-cmd --query-masquerade firewall-cmd --add-masquerade # 将80端口的流量转发至8080 firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080 # 将80端口的流量转发至 firewall-cmd --add-forward-port=port=80:proto=tcp:toaddr=192.168.1.0.1192.168.0.1 # 将80端口的流量转发至192.168.0.1的8080端口 firewall-cmd --add-forward-port=port=6198:proto=tcp:toaddr=172.16.0.11:toport=6379

vue webstrom报错 Expected indentation of 2 spaces but found 4

图片
"indent": ["error", 2]  - gives many  Expected indentation of 2 spaces but found 4 "indent": ["error", 4]  - gives many  Expected indentation of 4 spaces but found 8 "indent": ["error", 8]  - gives many  Expected indentation of 8 spaces but found 4 解决方法 \node_modules\eslint-config-standard\eslintrc.json "indent" : [ "error" , 4 , { "SwitchCase" : 1 } ] 参考链接: https://stackoverflow.com/questions/44737710/how-to-configure-eslint-indent-for-webstorm

PHPMailer配置163邮箱

图片
网易邮箱 登录到网易邮箱后如下图所示 进入到POP3/SMTP/IMAP设置页面 没有开启服务的小伙伴们请自己开启,开启过程中会验证一些手机号之类的, 完成后可以看到,<font color='red'>左侧栏有一个客户端授权密码的东西,这个很重要哦,一定要记下来</font> 下载PHPMailer并开启php_openssl、php_socket扩展 PHPMailer在github上可以搜索到,那么每次的更新都可以看到 地址  https://github.com/PHPMailer/PHPMailer php_openssl 和php_socket 这个必须要开启的,不管你是windows还是Linux 编写代码 我们将克隆下来的代码放到服务器根目录。进入到这个PHPMailer文件夹。 新建文件index.php 网易邮箱 <? php include_once "class.phpmailer.php" ; include_once "class.smtp.php" ; //获取一个外部文件的内容 $mail = new PHPMailer (); $body = "<h1>欢迎大家来到学习,我们一起共同进步</h1>" ; //设置smtp参数 $mail -> IsSMTP (); $mail -> SMTPAuth = true ; $mail -> SMTPKeepAlive = true ; $mail -> Host = "smtp.163.com" ; $mail -> Port = 25 ; //填写你的email账号和密码 $mail -> Username = "13033737678@163.com" ; $mail -> Password = "abcd*****xyz" ; #注意这里要填写授权码就是我在上面网易邮箱开启SMTP中提到的,不能填邮箱登录的密码哦。 //设置发送方,最好不要伪造地址 $mail -> From ...