分类目录归档:日志

dedecms调用指定栏目文章列表

我要调用指定栏目id为1的文章列表,下面是调用代码:

{dede:arclist typeid='1' titlelen='60' row='8'}
<div class="item">
    <div class="img">
        <a href="[field:arcurl/]" target="_blank"><img src="[field:picname/]" alt="[field:fulltitle/]" title="[field:fulltitle/]" /></a>
    </div>
    <div class="title"><a href="[field:arcurl%20/]">[field:title /]</a></div>
    <div class="time">[field:pubdate function="GetDateTimeMK(@me)"/]</div>
</div>
{/dede:arclist}

获取手机号码所属省份、城市、运营商Api接口

<?php
/**
 * 要查询的电话号码归属地
 * http://www.baidu.com/api.php?m=Tel&p=13281098058
 * {"province":"\u56db\u5ddd","city":"\u6210\u90fd","supplier":"\u8054\u901a"}
 * supplier 运营商 city 城市 province 省份
 * Some rights reserved:abc3210.com
 * Contact email:admin@abc3210.com
 */
class TelAction extends AppframeAction {
    public function index() {
        $mobile = $_GET['p'];  //要查询的电话号码
        $ko = $_GET['ko'];  //要查询的端口 1 为淘宝,2为财付通
        $data='';
        if($mobile){
           if($ko==1){
              $data=$this->taobao($mobile);
           }else{
              $data=$this->tenpay($mobile);
           }
        }
        exit($data);
    }

    private function taobao($mobile=0){//淘宝接口
        $url = "http://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=".$mobile."&t=".time();  //根据淘宝的数据库调用返回值
        $content = file_get_contents($url);
        $data['province'] = substr($content, "56", "4");  //截取字符串
        $data['supplier'] = substr($content, "81", "4");
        return '{"province":"'.$data['province'].'","supplier":"'.$data['supplier'].'"}';
    }

    private function tenpay($mobile=0){//财付通接口
        $doc = new DOMDocument(); 
        $xmlurl='http://life.tenpay.com/cgi-bin/mobile/MobileQueryAttribution.cgi?chgmobile='.$mobile.'&f.xml';
        $doc->load($xmlurl); //读取xml文件 
        $xmls = $doc->getElementsByTagName("root"); //取得root标签的对象数组 
        foreach( $xmls as $xml ) { 
            $province = $xml->getElementsByTagName( "province" ); //省份
            $data['province'] = $this->delspace($province->item(0)->nodeValue); //省份
            $city = $xml->getElementsByTagName( "city" ); 
            $data['city']= $this->delspace($city->item(0)->nodeValue); //城市
            $supplier = $xml->getElementsByTagName( "supplier" ); 
            $data['supplier'] = $this->delspace($supplier->item(0)->nodeValue); //联通 移动 电信
        }
        return json_encode($data);
    }
    //过滤空格回车
    private function delspace($pcon){
         $pcon = preg_replace("/ /","",$pcon);
         $pcon = preg_replace("/ /","",$pcon);
         $pcon = preg_replace("/ /","",$pcon);
         $pcon = preg_replace("/\r\n/","",$pcon);
         $pcon = str_replace(chr(13),"",$pcon);
         $pcon = str_replace(chr(10),"",$pcon);
         $pcon = str_replace(chr(9),"",$pcon);
         return $pcon;
    }

}
?>

在 linux 中自动备份 mysql

以下是我在服务器上利用cron部署的自动备份mysql数据库的shell脚本,脚本按天生成每次备份目录,生成的文件经过 gzip 压缩节省磁盘空间。

编辑口令配置 /home/mysql_backup/extra.cnf

[client]
user=mysqluser
password=mysqlpassword

编辑备份脚本 /home/mysql_backup/backsql.sh

#!/bin/bash
root='/home/back/mysql'
data="$root/data"
extra="$root/extra.cnf"
tag=`date +%Y/%m%d`
log="$data/backup.log"

mkdir -p $data/$tag/

mysqldump --defaults-extra-file=$extra tableName | pigz > $data/$tag/tableName.sql.gz

# 删除10天以前的备份
find $root/* -mtime +10 -exec rm {} \;

# 写日志
echo "backup finished at $(date +'%Y-%m-%d %H:%M:%S')" >> $log

继续阅读

linux 下使用 mount 配置虚拟目录

# mount --bind [原有的目录] [新目录]

比如我的ftp的默认目录是/home/public,我想把/mnt/soft文件夹,映射到/home/public目录中,我就如下操作:
我们要先在/var/ftp目录中建一个目录
 

# mkdir /home/public
# mount --bind /mnt/soft /home/public

继续阅读

debian系linux安装pure-ftpd

安装

安装 pure-ftpd

sudo apt-get install pure-ftpd

添加组

sudo groupadd ftpgroup

添加用户

sudo useradd -g ftpgroup -d /dev/null -s /etc ftpuser
sudo passwd ftpuser    # 设置任意密码,尽量复杂,无需记住

继续阅读

天猫装修全屏、轮播、导航css代码

天猫首页宽屏代码

<div style="height:540px;">
    <div class="sn-simple-logo" style="left:50%;top:auto;border:none;padding:0;">
        <div class="sn-simple-logo" style="left:-960px;top:auto;border:none;padding:0;">
            <img src="//gdp.alicdn.com/imgextra/i2/2110849581/TB2UX1AcVXXXXaRXXXXXXXXXXXX-2110849581.jpg" border="0" height="550" width="1920" />
        </div>
    </div>
</div>

继续阅读

firefox显示图像占位符

编辑以下文件(若文件不存在请创建此文件):

xp用户路径地址:

C:\Documents and Settings\用户名\Application Data\Mozilla\Firefox\Profiles\不固定字符串.default\chrome

win7用户路径地址:

C:\Users\用户名\AppData\Roaming\Mozilla\Firefox\Profiles\不固定字符串.default \chrome

linux用户路径地址:

~/.mozilla~/firefox/不固定字符串.default/chrome/userContent.css

继续阅读