当前位置: 首页>>代码示例>>PHP>>正文


PHP K::GUID方法代码示例

本文整理汇总了PHP中K::GUID方法的典型用法代码示例。如果您正苦于以下问题:PHP K::GUID方法的具体用法?PHP K::GUID怎么用?PHP K::GUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在K的用法示例。


在下文中一共展示了K::GUID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_function_YMD

/**
 *  需要加载Widget.YDM.js挂件一起使用
 */
function smarty_function_YMD($params, $smarty)
{
    $GUID = K::GUID(microtime());
    $class = $params['class'] ? ' ' . $params['class'] : '';
    $YMD = $params['YMD'] ? $params['YMD'] : date('Y-n-j');
    list($Y, $M, $D) = explode('-', $YMD);
    $Y = isset($params['Y']) ? $params['Y'] : $Y;
    $M = isset($params['M']) ? $params['M'] : $M;
    $D = isset($params['D']) ? $params['D'] : $D;
    $start = $params['start'] ? $params['start_year'] : 1970;
    $end = $params['end'] ? $params['end_year'] : date('Y');
    $name = $params['name'] ? $params['name'] : 'YMD';
    $yy = $mm = $dd = '';
    $yy .= '<select name="' . $name . '[Y]" Y="' . $Y . '" class="w-100' . $class . '">';
    for ($i = $end; $i >= $start; $i--) {
        $selected = $Y == $i ? ' selected="selected"' : '';
        $yy .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
    }
    $yy .= '</select>';
    $mm .= '<select name="' . $name . '[M]" M="' . $M . '" class="w-50' . $class . '">';
    for ($i = 1; $i <= 12; $i++) {
        $selected = $M == $i ? ' selected="selected"' : '';
        $mm .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
    }
    $mm .= '</select>';
    $dd .= '<select name="' . $name . '[D]" D="' . $D . '" class="w-50' . $class . '">';
    for ($i = 1; $i <= 31; $i++) {
        $selected = $D == $i ? ' selected="selected"' : '';
        $dd .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
    }
    $dd .= '</select>';
    $html = "<span id='{$GUID}'>{$yy}&nbsp;年&nbsp;&nbsp;{$mm}&nbsp;月&nbsp;&nbsp;{$dd}&nbsp;日</span>";
    $html .= "<script>(function(K, \$){Widget.YMD.init('#{$GUID}');})(window.KT, window.jQuery);</script>";
    return $html;
}
开发者ID:a195474368,项目名称:ejiawang,代码行数:38,代码来源:function.YMD.php

示例2: smarty_function_area

/**
 *  需要加载Widget.YDM.js挂件一起使用
 */
function smarty_function_area($params, $smarty)
{
    $GUID = K::GUID(microtime());
    $YMD = $params['YMD'] ? $params['YMD'] : date('Y-n-j');
    list($Y, $M, $D) = explode('-', $YMD);
    $Y = isset($params['Y']) ? isset($params['Y']) : $Y;
    $M = isset($params['M']) ? isset($params['M']) : $M;
    $D = isset($params['D']) ? isset($params['D']) : $D;
    $start = $params['start'] ? $params['start_year'] : 1970;
    $end = $params['end'] ? $params['end_year'] : date('Y');
    $name = $params['name'] ? $params['name'] : 'YMD';
    $yy = $mm = $dd = '';
    $yy .= '<select name="' . $name . '[Y]" Y="' . $Y . '">';
    for ($i = $start; $i <= $end; $i++) {
        $yy .= '<option value="' . $i . '">' . $i . '</option>';
    }
    $yy .= '</select>';
    $mm .= '<select name="' . $name . '[M]" M="' . $M . '">';
    for ($i = 1; $i <= 12; $i++) {
        $mm .= '<option value="' . $i . '">' . $i . '</option>';
    }
    $mm .= '</select>';
    $dd .= '<select name="' . $name . '[D]" D="' . $D . '">';
    for ($i = 1; $i <= 31; $i++) {
        $dd .= '<option value="' . $i . '">' . $i . '</option>';
    }
    $dd .= '</select>';
    $html = "<span id='{$GUID}''>{$yy}年{$mm}月{$dd}日</span>";
    $html .= "<script>(function(T, \$){Widget.YMD.init('#{$GUID}');})(window.TP, window.jQuery);</script>";
    return $html;
}
开发者ID:a195474368,项目名称:ejiawang,代码行数:34,代码来源:function.area.php

示例3: fetch

 public function fetch($widget, &$smarty)
 {
     $file = __CFG::DIR . "plugins/widgets/" . $widget['widget'] . '/widget.php';
     if (!$widget['method']) {
         $widget['method'] = 'index';
     }
     $wdt = K::W($widget['widget']);
     $wdt->smarty =& $smarty;
     if (!method_exists($wdt, $widget['method'])) {
         $widget['act'] = $widget['method'];
         $widget['method'] = 'index';
     }
     if (!($data = $wdt->{$widget}['method']($widget))) {
         return '';
     }
     $smarty->assign('data', $data);
     $widget['GUID'] = K::GUID('widget');
     $smarty->assign('widget', $widget);
     if (!$widget['tpl']) {
         $widget['tpl'] = 'widget:/default/default.html';
     }
     if (strpos($widget['tpl'], ':') === false && strpos($widget['tpl'], '/') === false) {
         $tmpl = "widget:{$widget['widget']}/{$widget['tpl']}";
     } else {
         $tmpl = $widget['tpl'];
     }
     return $smarty->fetch($tmpl);
 }
开发者ID:a195474368,项目名称:ejiawang,代码行数:28,代码来源:widget.mdl.php

示例4: Instance

 public function Instance()
 {
     $_clen = strlen(__CFG::C_PREFIX);
     $filter = K::M('content/filter');
     foreach ($_COOKIE as $k => $v) {
         if (substr($k, 0, $_clen) == __CFG::C_PREFIX) {
             $this->_COOKIE[substr($k, $_clen)] = $filter->addslashes($v);
         }
     }
     if (!($this->GUID = $this->_COOKIE['GUID'])) {
         $this->GUID = 'KT-' . K::GUID('cookie');
         $this->set('GUID', $this->GUID);
     }
 }
开发者ID:a195474368,项目名称:ejiawang,代码行数:14,代码来源:cookie.mdl.php

示例5: smarty_function_region

/**
 *  需要加载Widget.YDM.js挂件一起使用
 */
function smarty_function_region($params, $smarty)
{
    $GUID = K::GUID(microtime());
    $name = $params['name'] ? $params['name'] : 'region';
    $regionId = $params['region'] ? $params['region'] : 0;
    $oRegion = K::M('data/region');
    $pid = 0;
    $region = null;
    if ($regionId && ($region = $oRegion->region($regionId))) {
        if ($region['region_typ'] == 2) {
            $pid = $region['parent_id'];
        } else {
            if ($region['region_type'] == 1) {
                $pid = $region['region_id'];
            }
        }
    }
    $provinces = $oRegion->provice_list();
    $html .= '<span id="' . $GUID . '"><select name="area[province]" val="' . $pid . '">';
    foreach ($provinces as $k => $v) {
        $html .= "<option value=\"{$v['region_id']}\">{$v['region_name']}</option>";
    }
    $html .= '</select>';
    $html .= '<select name="area[city]" val="' . $regionId . '">';
    if ($pid) {
        $city_list = $oRegion->city_list($pid);
        foreach ($city_list as $v) {
            $html .= "<option value=\"{$v['region_id']}\">{$v['region_name']}</option>";
        }
    } else {
        $html .= "<option value=''>请选择</option>";
    }
    $html .= '</select></span>';
    $html .= "<script>(function(T, \$){Widget.Area.init('#{$GUID}');})(window.TP, window.jQuery);</script>";
    return $html;
}
开发者ID:a195474368,项目名称:ejiawang,代码行数:39,代码来源:function.region.php


注:本文中的K::GUID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。