centos 开启端口服务

查看所有端口情况

netstat -ano

开启 465 端口

/sbin/iptables -I INPUT -p tcp --dport 465 -j ACCEPT   写入修改
/etc/init.d/iptables save                              保存修改
service iptables restart                               重启防火墙,修改生效

查看 465 端口详情

netstat -an | grep 465

PHP 随机输出一句话

function.php 文件中添加代码

function random_str() { 
$poems="Hello World
已知花意,未见其花,已见其花,未闻花名
如果能不长大就好了啊,可是时光在身后挡住退路
或许前路永夜,即便如此我也要前进,因为星光即使微弱也会为我照亮前路
你驻足于春色中,于那独一无二的春色之中
生活是不公平的,要去适应它"; 
$poems=explode("\n",$poems); 
return $poems[rand(0,count($poems)-1)]; 
} 
function says(){ 
    $says=random_str(); 
    echo $says; 
}

  翻  牌  子

Typecho 设置评论者链接从新窗口中打开

修改 Comments.php 文件
文件所在位置 /var/Widget/Abstract/Comments.php
修改代码(约第 376 行)

//echo '<a href="' , $this->url , '"' , ($noFollow ? ' rel="external nofollow"' : NULL) , '>' , $this->author , '</a>';//原代码
echo '<a href="' , $this->url , '"' , ($noFollow ? ' rel="external nofollow"' : NULL) ,  ' target="_blank" ' ,'>' , $this->author , '</a>';//添加_blank属性

Typecho 计算文章字数

将以下代码插入到主题中的 functions.php 文件中

function  art_count ($cid){
    $db=Typecho_Db::get ();
    $rs=$db->fetchRow ($db->select ('table.contents.text')->from ('table.contents')->where ('table.contents.cid=?',$cid)->order ('table.contents.cid',Typecho_Db::SORT_ASC)->limit (1));
    $text = preg_replace("/[^\x{4e00}-\x{9fa5}]/u", "", $rs['text']);
    echo mb_strlen($text,'UTF-8');
}

  翻  牌  子