2018年8月

其实就是判断查找文章的第一个p,然后,插入代码,放到functions里使用即可。

function themeInit($archive) {

   // 判断是否是文章,如果是就插入广告
   $ad_code = '<div>这是你的广告</div>';
   if ($archive->is('single')) {
        $archive->content = prefix_insert_after_paragraph( $ad_code, 2, $archive->content );;
    }
}

// 插入广告所需的功能代码
function prefix_insert_after_paragraph( $insertion, $paragraph_id, $content ) {
   $closing_p = '</p>';
   $paragraphs = explode( $closing_p, $content );
   foreach ($paragraphs as $index => $paragraph) {
      if ( trim( $paragraph ) ) {
         $paragraphs[$index] .= $closing_p;
      }
      if ( $paragraph_id == $index + 1 ) {
         $paragraphs[$index] .= $insertion;
      }
   }
   return implode( '', $paragraphs );
}

第一步:称呼.
没什么特别的话可以就用
Hi, there,
Hello,
Hi,XXX (认识某人的话)
如果想客气点可以用
Dear,
Dear Support,
Dear Customer Service,
Dear XXX,

第二步:内容
这一部分概要的讲你所面临的问题说出来即可,但注意需要礼貌点,人家也是打工的.
礼尚往来,你客气点,人家也会以同样的方式对你.
如果是回信的话,也可以先感谢他之前提供的信息,比如 Thank you for the detailed information (that you provided on the last email/conversation). Thank you for the prompt reply. 或者Thank you for letting me know the detailed, it’s very informative.
然后就可以接着写正文,句子不要太长,太长容易错也不好理解. 比如很多人想换服务器,
你可以这样写: During the tests, it seems like the IO performance is a little bit slow on my current physical node. 首先提出问题所在,就是IO很慢,但是不要那么直白,seems like就是你持怀疑态度,不是很爽目前的状况. 然后可以客气点说 It would be wonderful(great, nice, fantastic, fabulous, superb, ideal, marvelous) that if you can migrate (move, transfer) my VPS to another node with better IO performance.括号里词都可以用, 当然你一直用一个也行的,不要怕重复用就觉得自己英文不好, 老外不会鸟这些东西,只要你会英文,他们都觉得你厉害.
到这里,你基本上讲完了问题所在和你想要干什么. 只有两句,但是足够了.
第三步:结束
I would appreciate it if you could let me know shortly.
I would appreciate it if you could get back to me shortly( ASAP, soon).
Your prompt reply(response) would be appreciated.
然后再加上
Thank you.
Thanks ;)
Thanks again.
最后:你还可以注上你的大名.
完整的例子:
Dear Support,
Thank you for the hard work to offer me such a great product. During the tests, it seems like the IO performance is a little bit slow on my current physical node and I am wondering why would this happen. It would be wonderful if you could kindly migrate my VPS to another node with better IO performance.

I would appreciate it if you could let me know shortly.

Thank you.
cn.Vicer

本文采摘自萌咖

下载https://www.lanzous.com/i1llnja (nginx-ct.zip)
下载https://www.lanzous.com/i1llnhi(ct-submit.zip)
上传至root目录

yum install golang -y

tar -zxvf nginx-ct.zip
tar -zxvf ct-submit.zip

编辑lnmp1.5配置文件扩展CT模块

cd lnmp1.5
vim lnmp.conf

Nginx_Modules_Options='--add-module=/root/nginx-ct-master'
PHP_Modules_Options=''

##MySQL/MariaDB database directory##
MySQL_Data_Dir='/usr/local/mysql/var'
MariaDB_Data_Dir='/usr/local/mariadb/var'
##Default website home directory##
Default_Website_Dir='/home/wwwroot/default'

Enable_Nginx_Openssl='n'
Enable_PHP_Fileinfo='n'
Enable_Nginx_Lua='n'

保存并退出

使用./upgrade.sh nginx 升级重新编译nginx

cd /root/ct-submit-master/
go build
./ct-submit-master ct.googleapis.com/rocketeer </证书目录/证书> /存放路径/名称.sct
./ct-submit-master ct.googleapis.com/icarus </证书目录/证书> /存放路径/名称.sct
./ct-submit-master ct.googleapis.com/pilot </证书目录/证书> /存放路径/名称.sct

生成完成后编辑nginx的配置文件
在server下添加

ssl_ct on; #开启 nginx-ct

单证书
ssl_ct_static_scts /path/to/scts/; #这里填写 sct 文件的目录路径,而不是文件路径。

多证书需把对应证书的sct文件放在不同目录
证书
ssl_ct_static_scts /path/to/scts/; #这里填写 sct 文件的目录路径,而不是文件路径。
私密

lnmp restart 重启即可

1.首先用命令free查看系统内 Swap 分区大小
  free -m
显示

Mem: 2012 1960 51 0 748 950 

  -/+ buffers/cache: 260 1751
  Swap: 255 0 255
2.创建一个 Swap 文件
  找一个空间足够的目录用来存放swap文件
  mkdir /swap
  cd /swap
  sudo dd if=/dev/zero of=swapfile bs=1024 count=2000000
  出现下列提示,上面命令中的 count 即代表swap文件大小。
  记录了2000000+0 的读入
  记录了2000000+0 的写出
  2048000000字节(2.0 GB)已复制,63.3147 秒,32.3 MB/秒
  把生成的文件转换成 Swap 文件

  sudo mkswap -f swapfile 

显示
Setting up swapspace version 1, size = 1999996 KiB
no label, UUID=fee9ab21-9efb-47c9-80f4-57e48142dd69

3.激活 Swap 文件
  

sudo swapon swapfile 

  再次查看 free -m 的结果。
显示
total used free shared buffers cached
  Mem: 2012 1971 41 0 572 1156
  -/+ buffers/cache: 241 1770
  Swap: 2209 0 2209
  添加成功。

扩展:
  如果需要卸载这个 swap 文件,可以进入建立的 swap 文件目录。执行下列命令。
  

sudo swapoff swapfile

  如果需要一直保持这个 swap ,可以把它写入 vi /etc/fstab 文件。
  

/swap/swapfile /swap swap defaults 0 0