JS - 获取昨天、今天的日期

获取昨天日期

function yesterday() {
    var timenow = new Date();
    timenow.setDate(timenow.getDate() - 1); //设置天数 -1 天,昨天的日期
    var y = timenow.getFullYear();//年
    var m = timenow.getMonth() + 1;//月
    m = m < 10 ? '0' + m : m;
    var d = timenow.getDate();//日
    d = d < 10 ? ('0' + d) : d;
    var yesterdayTime = y + '/' + m + '/' + d;//yyyy/mm/dd格式
    return yesterdayTime;
}

  翻  牌  子

apache - 映射

Alias /imgSrc/ “/sdzw/ibp/upload/ptlogin/”
<Directory “/sdzw/ibp/upload/ptlogin/”>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    Allow from all
</ Directory>

  翻  牌  子

bootstrap - alert

<style>
.alert{
    display: none;
    position: fixed;
    top: 1%;
    left: 45%;
    z-index: 999;
    border: 1px solid transparent;
    border-radius: 5px;
}
.alert-success {
    color: #3c763d;
    background-color: #dff0d8;
    border-color: #d6e9c6;
}
.alert-info {
    color: #31708f;
    background-color: #d9edf7;
    border-color: #bce8f1;
}
.alert-warning {
    color: #8a6b3b;
    background-color: #fcf8e3;
    border-color: #faebcc;
}
.alert-danger {
    color: #a94442;
    background-color: #f2dede;
    border-color: #ebccd1;
}
</style>
<script>
/*
 * .alert-success
 * .alert-info
 * .alert-warning
 * .alert-danger
 */
function alertShow(style, message){
    $('.alert').remove();
    $('<div>').appendTo('body').addClass('alert ' + style).html(message).show();
}
function alertHidden(time){
    $('.alert').delay(time).fadeOut();
}
</script>

  翻  牌  子

MYSQL - group_concat

group_actionid 表

groupid actionid groupname
g01 a01 下路
g02 a02 中路
g01 a03 下路
g01 a02 下路

actionid 表

actionid actionname displayname
a01 aixi 寒冰射手
a02 yasuo 疾风剑豪
a03 jinkesi 暴走萝莉

  翻  牌  子

PHP - 调用 webservice 接口 - php 5.4 以下

<?php
header('Content-Type:text/html; charset=utf-8');
require_once('nusoap.php');
$ip = $_REQUEST['ip'];
$func = $_REQUEST['func'];
$param = $_REQUEST['param'];
$namespace = $_REQUEST['namespace'];
$paras = json_decode(json_encode($param), true);
try{
    $client = new soapclient('http://'.$ip.'/xx/Webservice?wsdl', true);
    $client->soap_defencoding = 'UTF-8';
    $client->decode_utf8 = false;
    $client->xml_encoding = 'UTF-8';
    $result = $client->call($func, $paras, $namespace);
    print_r($result);
}catch(SoapFault $exception){
    print_r($exception);
}
?>

  翻  牌  子

PHP - 调用 webservice 接口 - php 5.4 以上

requestWsdl.php

<?php
header('content-type:text/html;charset=utf-8');
$ip = $_RESQUEST['ip'];
$function = $_REQUEST['function'];
$param = $_REQUEST['param'];
$res = new WSDL();
$res->getData($ip, $function, $param);
class WSDL{
    public function __construct(){
    }
    public function getData($ip, $function, $param = array()){
        try {
            $client = new SoapClient('http://' . $ip . '/xxx/Webservice?wsdl',
array('encoding' => 'UTF-8'));
            $result = $client->{$function}($param);
            $result = get_object_vars($result);
            print_r($result);
        } catch (SoapFault $exception) {
            print_r($exception);
        }
    }
    public function getFunctions($ip){
        $client = new SoapClient('http://' . $ip . '/xxx/Webservice?wsdl', 
array('encoding' => 'UTF-8'));
        $functions = $client->__getFunctions();
        print_r($functions);
    }
    public function getTypes($ip){
        $client = new SoapClient('http://' . $ip . '/xxx/Webservice?wsdl', array('encoding' => 'UTF-8'));
        $types = $client->__getTypes();
        print_r($types);
    }
}

  翻  牌  子

PHP - 递归无限级分类下的所有子集

<?php
/**
 * 递归无限级分类【先序遍历算】,获取任意节点下所有子孩子
 * @param array $arrCate 待排序的数组
 * @param int $parent_id 父级节点
 * @param int $level 层级数
 * @return array $arrTree 排序后的数组
 */
function getMenuTree($arrCat, $parent_id = 0, $level = 0)
{
    static  $arrTree = array(); //使用static代替global
    if( empty($arrCat)) {
        return FALSE;
    }
    $level++;
    foreach($arrCat as $key => $value)
    {
        if($value['parent_id' ] == $parent_id)
        {
            $value[ 'level'] = $level;
            $arrTree[] = $value;
            unset($arrCat[$key]); //注销当前节点数据,减少已无用的遍历
            getMenuTree($arrCat, $value[ 'id'], $level);
        }
    }
    return $arrTree;
}
/**
 * 测试数据
 */
$arrCate = array(  //待排序数组
    array( 'id'=>1, 'name' =>'顶级栏目一', 'parent_id'=>0),
    array( 'id'=>2, 'name' =>'顶级栏目二', 'parent_id'=>0),
    array( 'id'=>3, 'name' =>'栏目三', 'parent_id'=>1),
    array( 'id'=>4, 'name' =>'栏目四', 'parent_id'=>3),
    array( 'id'=>5, 'name' =>'栏目五', 'parent_id'=>4),
    array( 'id'=>6, 'name' =>'栏目六', 'parent_id'=>2)
);
header('Content-type:text/html; charset=utf-8'); //设置utf-8编码
echo '<pre>';
print_r(getMenuTree($arrCate, 0, 0));
echo '</pre>';
?>

  翻  牌  子