叶测试 发布的文章

ThinkPHP5 自定义模版标签tablib

ThinkPHP5 自定义模版标签tablib

新建文件application/common/taglib/Diy.php
Diy.php

<?php
// +----------------------------------------------------------------------
// | 自定义模版标签
// +----------------------------------------------------------------------
// | Author: SenSen <1050575278> 2018-12
// +----------------------------------------------------------------------
namespace app\common\taglib;

use think\Db;
use think\template\TagLib;

class Sen extends TagLib
{
    protected $tags = [
        'arclist' => ['attr'=> 'field,id,limit,cid,order,name,flag,type', 'close'=>1],
        'show' => ['attr'=> 'title,field', 'close'=>0],
    ];

    /**
     * 文章标签
     * @param $tag
     * @param $content
     * @return string
     */
    public function tagArclist($tag, $content)
    {
        $id = isset($tag['id']) ? $tag['id'] : 'vo';
        $order = empty($tag['order']) ? "'id DESC'" : '"'.$tag['order'].'"';
        $name = 'article';
        $field = "''";
        if (!empty($tag['field'])) {
            if (strpos($tag['field'], '$') === 0) {
                $field = $tag['field'];
                $this->autoBuildVar($field);
            } else {
                $field = "'{$tag['field']}'";
            }
        }
        $cid = "''";
        if (!empty($tag['cid'])) {
            if (strpos($tag['cid'], '$') === 0) {
                $cid = $tag['cid'];
                $this->autoBuildVar($cid);
            } else {
                $cid = "'{$tag['cid']}'";
            }
        }
        $flag = "''";
        if (!empty($tag['flag'])) {
            if (strpos($tag['flag'], '$') === 0) {
                $flag = $tag['flag'];
                $this->autoBuildVar($flag);
            } else {
                $flag = "'{$tag['flag']}'";
            }
        }
        $type = "''";
        if (!empty($tag['type'])) {
            if (strpos($tag['type'], '$') === 0) {
                $type = $tag['type'];
                $this->autoBuildVar($type);
            } else {
                $type = "'{$tag['type']}'";
            }
        }
        $limit = "''";
        if (!empty($tag['limit'])) {
            if (strpos($tag['limit'], '$') === 0) {
                $limit = $tag['limit'];
                $this->autoBuildVar($limit);
            } else {
                $limit = "'{$tag['limit']}'";
            }
        }else{
            $limit = '0,6';
        }
        $parse = <<<parse
<?php
    \$$name = \app\common\model\Article::tagArticle([
    'field'   => {$field},
    'cid'=>{$cid},
    'limit'=>{$limit},
    'flag'=>{$flag},
    'type'=>{$type},
    'order'=>{$order}
]);
?>
{volist name="{$name}" id="{$id}"}
{$content}
{/volist}
parse;
        return $parse;
    }

    /**
     * 广告标签
     * @param $tag
     * @return mixed
     */
    public function tagShow($tag)
    {
        $title = $tag['title'] ? $tag['title'] : '';
        $result = Db::name('ad')->where(['tag'=>$title, 'status'=>1])->find();
        return $result['content'];
    }

}

- 阅读剩余部分 -

lamp linux centos升级php5.4到5.6

升级编译参数

./configure --prefix=/usr/local/php56 \
--with-config-file-path=/usr/local/php56/etc \
--with-bz2 \
--with-curl \
--enable-ftp \
--enable-sockets \
--disable-ipv6 \
--with-gd \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--with-freetype-dir=/usr/local \
--enable-gd-native-ttf \
--with-iconv-dir=/usr/local \
--enable-mbstring \
--enable-calendar \
--with-gettext \
--with-ldap \
--with-libxml-dir=/usr/local \
--with-zlib \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-mysql=mysqlnd \
--enable-dom \
--enable-xml \
--enable-fpm \
--enable-bcmath \
--enable-pcntl \
--with-mhash \
--enable-zip \
--with-openssl \
--enable-opcache \
--with-pear \
--with-apxs2=/usr/local/apache2/bin/apxs

PHP下载微信头像 微信活动海报

最近搞一个微信分享吸粉的活动,需要生成用户推广海报,使用TP的图像处理类可轻易添加昵称、图片、二维码等水印信息。但在生成此海报时,由于下载微信头像到本地/服务器用时太长,导致海报生成时间过长问题。

解决方法
使用curl压缩下载图片,加速图片下载速度,实现海报生成速度由8s左右到1s的提升。

- 阅读剩余部分 -

UUID简介

UUID 通用唯一识别码(Universally Unique Identifier)其目的,是让分布式系统中的所有元素,都能有唯一的辨识信息,而不需要通过中央控制端来做辨识信息的指定。

UUID是指在一台机器上生成的数字,它保证对在同一时空中的所有机器都是唯一的。通常平台会提供生成的API。按照开放软件基金会(OSF)制定的标准计算,用到了以太网卡地址、纳秒级时间、芯片ID码和许多可能的数字。

- 阅读剩余部分 -

呼叫系统软电话eyebeam/x-lite使用

近期为公司客服人员开发了一套呼叫系统,嫁接OA系统实现快速、随时随地登陆系统呼叫客户。

  • 硬件基于上海迅时OM80E
  • 呼叫系统自行开发(当前仅开发了外呼、录音等核心功能,后期逐步完善语音导航菜单、呼入及公司账号、单一OM多应用公用等等)
  • 软电话使用eyebeam
  • 外网访问可选择内网穿透或公网IP(穿透需局域网录音脚本上传服务器,公网可即时回放通话录音)

- 阅读剩余部分 -

手机点击图片显示蓝色区域 bootstrap点击阴影modal模态框不消失

*{
    -webkit-tap-highlight-color: rgba(255,0,0,0);
    -webkit-appearance:none;
}    

//在样式里面加个这个就会没有蓝色的区域

bootstrap点击阴影模态框不消失

  1. 模态框添加data-backdrop="static"
  2. 调用 $("#myModal").modal({backdrop:'static',keyboard:false});
    backdrop 为 static 时,点击模态对话框的外部区域不会将其关闭。
    keyboard 为 false 时,按下 Esc 键不会关闭 Modal。