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


PHP to_guid_string函数代码示例

本文整理汇总了PHP中to_guid_string函数的典型用法代码示例。如果您正苦于以下问题:PHP to_guid_string函数的具体用法?PHP to_guid_string怎么用?PHP to_guid_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getInstance

 /**
  * 取得数据库类实例
  * @static
  * @access public
  * @return mixed 返回数据库驱动类
  */
 public static function getInstance($db_config = '')
 {
     static $_instance = array();
     $guid = to_guid_string($db_config);
     if (!isset($_instance[$guid])) {
         $obj = new Db();
         $_instance[$guid] = $obj->factory($db_config);
     }
     return $_instance[$guid];
 }
开发者ID:tiger2soft,项目名称:thinkphp-zcms,代码行数:16,代码来源:Db.class.php

示例2: getInstance

 /**
  * 取得缓存类实例
  * 
  * @static
  *
  * @access public
  * @return mixed
  */
 static function getInstance($type = '', $options = array())
 {
     static $_instance = array();
     $guid = $type . to_guid_string($options);
     if (!isset($_instance[$guid])) {
         $obj = new Cache();
         $_instance[$guid] = $obj->connect($type, $options);
     }
     return $_instance[$guid];
 }
开发者ID:siimanager,项目名称:sii,代码行数:18,代码来源:Cache.class.php

示例3: position

 /**
  * 推荐位数据获取
  * 参数名	 是否必须	 默认值	 说明
  * posid	 是	 null	 推荐位ID
  * catid	 否	 null	 调用栏目ID
  * thumb	 否	 0	 是否仅必须缩略图
  * order	 否	 null	 排序类型
  * num	 是	 null	 数据调用数量
  * @param type $data 
  */
 public function position($data)
 {
     //缓存时间
     $cache = (int) $data['cache'];
     $cacheID = to_guid_string($data);
     if ($cache && ($return = S($cacheID))) {
         return $return;
     }
     $posid = (int) $data['posid'];
     if ($posid < 1) {
         return false;
     }
     $catid = (int) $data['catid'];
     $thumb = isset($data['thumb']) ? $data['thumb'] : 0;
     $order = empty($data['order']) ? array("listorder" => "DESC", "id" => "DESC") : $data['order'];
     $num = (int) $data['num'];
     $db = M("PositionData");
     $Position = F("Position");
     if ($num == 0) {
         $num = $Position[$posid]['maxnum'];
     }
     $where = array();
     //设置SQL where 部分
     if (isset($data['where']) && $data['where']) {
         $where['_string'] = $data['where'];
     }
     $where['posid'] = array("EQ", $posid);
     if ($thumb) {
         $where['thumb'] = array("EQ", 1);
     }
     if ($catid > 0) {
         $cat = getCategory($catid);
         if ($cat) {
             //是否包含子栏目
             if ($cat['child']) {
                 $where['catid'] = array("IN", $cat['arrchildid']);
             } else {
                 $where['catid'] = array("EQ", $catid);
             }
         }
     }
     $data = $db->where($where)->order($order)->limit($num)->select();
     foreach ($data as $k => $v) {
         $data[$k]['data'] = unserialize($v['data']);
         $tab = ucwords(getModel($v['modelid'], 'tablename'));
         $data[$k]['data']['url'] = M($tab)->where(array("id" => $v['id']))->getField("url");
     }
     //结果进行缓存
     if ($cache) {
         S($cacheID, $data, $cache);
     }
     return $data;
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:63,代码来源:PositionTagLib.class.php

示例4: getInstance

 /**
  * 获取本类实例
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-04-06 12:55:37
  *
  * @param array $config 配置。默认null,C('TEMPLATE_CONFIG')
  *
  * @return object 本类实例
  */
 public static function getInstance($config = null)
 {
     if (null === $config && ($v = C('TEMPLATE_CONFIG'))) {
         $config = $v;
     }
     $config = $config ? $config : array();
     $identify = to_guid_string($config);
     if (!isset(self::$_instance[$identify])) {
         self::$_instance[$identify] = new Template($config);
     }
     return self::$_instance[$identify];
 }
开发者ID:yunsite,项目名称:yablog,代码行数:22,代码来源:Template.class.php

示例5: __construct

 public function __construct(array $config)
 {
     $this->config = $config;
     $unNum = to_guid_string($config);
     $this->link = new Memcached($unNum);
     $this->link->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
     if (!count($this->link->getServerList())) {
         foreach ($config as $server) {
             $this->link->addServer($server['hosts'], $server['port'], $server['weight']);
         }
     }
     return $this;
 }
开发者ID:knowsee,项目名称:uoke_framework,代码行数:13,代码来源:memcached.class.php

示例6: getInstance

 /**
  * 取得Service 服务
  * @static
  * @access public
  * @return mixed
  */
 static function getInstance($type = '', $options = array())
 {
     static $_instance = array();
     $guid = $type . to_guid_string($options);
     if (!isset($_instance[$guid])) {
         $class = strpos($type, '\\') ? $type : 'Libs\\Service\\' . ucwords(strtolower($type));
         if (class_exists($class)) {
             $connect = new $class($options);
             $_instance[$guid] = $connect->connect($type, $options);
         } else {
             E('Service 服务类不存在!');
         }
     }
     return $_instance[$guid];
 }
开发者ID:gzwyufei,项目名称:hp,代码行数:21,代码来源:Service.class.php

示例7: register

 /**
  * 用户注册
  */
 public function register()
 {
     $rv = array('status' => -1, 'msg' => '账号已存在!');
     $loginName = I('username');
     $loginPwd = I('password');
     $rs = $this->checkLoginKey($loginName);
     if ($rs['status'] == 1) {
         $m = M('users');
         $data = array();
         $data['loginName'] = $loginName;
         $data["loginSecret"] = rand(1000, 9999);
         $data['loginPwd'] = md5($loginPwd . $data['loginSecret']);
         $data['userType'] = 0;
         $data['createTime'] = date('Y-m-d H:i:s');
         $data['userFlag'] = 1;
         $rs = $m->add($data);
         if (false !== $rs) {
             $data = array();
             $data["userId"] = $rs;
             $data["loginTime"] = date('Y-m-d H:i:s');
             $data["loginIp"] = get_client_ip();
             $data["loginSrc"] = 2;
             $data["loginRemark"] = I('loginRemark');
             M('log_user_logins')->add($data);
             //记录tokenId
             $data = array();
             $key = sprintf('%011d', $urs['userId']);
             $tokenId = to_guid_string($key . time());
             $rv['status'] = 1;
             $data['userId'] = $rs;
             $data['tokenId'] = $tokenId;
             $data['startTime'] = date('Y-m-d H:i:s');
             $data['deviceId'] = I('deviceId');
             M('app_session')->add($data);
             $rv['data'] = $this->getUserInfo($rs);
             $rv['data']['tokenId'] = $tokenId;
             self::login();
             //注册成功后登录
         }
     }
     return $rv;
 }
开发者ID:moonlight-wang,项目名称:flmall,代码行数:45,代码来源:UsersModel.class.php

示例8: bang

 /**
  * 评论排行榜
  * @param type $data 
  */
 public function bang($data)
 {
     //缓存时间
     $cache = (int) $data['cache'];
     $cacheID = to_guid_string($data);
     if ($cache && ($cachedata = S($cacheID))) {
         return $cachedata;
     }
     //返回信息数
     $num = $data['num'] ? (int) $data['num'] : 10;
     $db = D("Comments");
     $data = $db->field(array('*', 'count(*)' => 'total'))->group('comment_id')->order(array('total' => 'DESC'))->limit($num)->select();
     //数据处理
     $return = array();
     foreach ($data as $r) {
         list($m, $catid, $id) = explode('-', $r['comment_id']);
         if (getCategory($catid, 'type') && getCategory($catid, 'type') != 0) {
             continue;
         }
         $modeid = getCategory($catid, 'modelid');
         $tablename = ucwords(getModel($modeid, 'tablename'));
         $return[$id] = M($tablename)->where(array('id' => $id))->find();
         $return[$id]['comment_total'] = $r['total'];
     }
     //结果进行缓存
     if ($cache) {
         S($cacheID, $return, $cache);
     }
     return $return;
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:34,代码来源:CommentTagLib.class.php

示例9: page

function page($total, $size = 0, $number = 0, $config = array())
{
    static $_pageCache = array();
    $cacheIterateId = to_guid_string(func_get_args());
    if (isset($_pageCache[$cacheIterateId])) {
        return $_pageCache[$cacheIterateId];
    }
    $defaultConfig = array('number' => $number, 'param' => C("VAR_PAGE"), 'rule' => '', 'isrule' => false, 'tpl' => '', 'tplconfig' => array('listlong' => 6, 'listsidelong' => 2, "first" => "首页", "last" => "尾页", "prev" => "上一页", "next" => "下一页", "list" => "*", "disabledclass" => ""));
    $cfg = array('listlong' => 6, 'listsidelong' => 2, 'list' => '*', 'currentclass' => 'current', 'first' => '&laquo;', 'prev' => '&#8249;', 'next' => '&#8250;', 'last' => '&raquo;', 'more' => '...', 'disabledclass' => 'disabled', 'jump' => '', 'jumpplus' => '', 'jumpaction' => '', 'jumplong' => 50);
    if (!empty($config) && is_array($config)) {
        $defaultConfig = array_merge($defaultConfig, $config);
    }
    $defaultConfig['size'] = $size ? $size : C("PAGE_LISTROWS");
    foreach ($cfg as $key => $value) {
        if (isset($defaultConfig[$key])) {
            $defaultConfig['tplconfig'][$key] = isset($defaultConfig[$key]) ? $defaultConfig[$key] : $value;
        }
    }
    import('Page');
    if ($defaultConfig['isrule'] && empty($defaultConfig['rule'])) {
        $URLRULE = $GLOBALS['URLRULE'] ? $GLOBALS['URLRULE'] : URLRULE;
        $PageLink = array();
        if (!is_array($URLRULE)) {
            $URLRULE = explode("~", $URLRULE);
        }
        $PageLink['index'] = $URLRULE['index'] ? $URLRULE['index'] : $URLRULE[0];
        $PageLink['list'] = $URLRULE['list'] ? $URLRULE['list'] : $URLRULE[1];
        $defaultConfig['rule'] = $PageLink;
    } else {
        if ($defaultConfig['isrule'] && !is_array($defaultConfig['rule'])) {
            $URLRULE = explode('|', $defaultConfig['rule']);
            $PageLink = array();
            $PageLink['index'] = $URLRULE[0];
            $PageLink['list'] = $URLRULE[1];
            $defaultConfig['rule'] = $PageLink;
        }
    }
    $Page = new Page($total, $defaultConfig['size'], $defaultConfig['number'], $defaultConfig['list'], $defaultConfig['param'], $defaultConfig['rule'], $defaultConfig['isrule']);
    $Page->SetPager('default', $defaultConfig['tpl'], $defaultConfig['tplconfig']);
    $_pageCache[$cacheIterateId] = $Page;
    return $_pageCache[$cacheIterateId];
}
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:42,代码来源:~runtime.php

示例10: _read

 /**
 +----------------------------------------------------------
 * 数据库Read操作入口
 +----------------------------------------------------------
 * @access private 
 +----------------------------------------------------------
 * @param mixed $condition 查询条件
 * @param string $fields 查询字段
 * @param boolean $all 是否返回多个数据
 * @param string $order 
 * @param string $limit 
 * @param string $group 
 * @param string $having 
 * @param string $join 
 * @param boolean $cache 是否查询缓存
 * @param boolean $relation 是否关联查询
 * @param boolean $lazy 是否惰性查询
 * @param boolean $lock 是否加锁
 +----------------------------------------------------------
 * @return boolean
 +----------------------------------------------------------
 */
 private function _read($condition = '', $fields = '*', $all = false, $order = '', $limit = '', $group = '', $having = '', $join = '', $cache = false, $relation = false, $lazy = false, $lock = false)
 {
     $table = $this->getTableName();
     if (!empty($this->options)) {
         // 已经有定义的查询表达式
         $condition = $this->options['where'] ? $this->options['where'] : $condition;
         $table = $this->options['table'] ? $this->options['table'] : $this->getTableName();
         $fields = $this->options['filed'] ? $this->options['field'] : $fields;
         $limit = $this->options['limit'] ? $this->options['limit'] : $limit;
         $order = $this->options['order'] ? $this->options['order'] : $order;
         $group = $this->options['group'] ? $this->options['group'] : $group;
         $having = $this->options['having'] ? $this->options['having'] : $having;
         $join = $this->options['join'] ? $this->options['join'] : $join;
         $cache = isset($this->options['cache']) ? $this->options['cache'] : $cache;
         $lock = isset($this->options['lock']) ? $this->options['lock'] : $lock;
         $lazy = isset($this->options['lazy']) ? $this->options['lazy'] : $lazy;
         $relation = isset($this->options['link']) ? $this->options['link'] : $relation;
         unset($this->options);
     }
     // 前置调用
     if (!$this->_before_read($condition)) {
         // 如果返回false 中止
         return false;
     }
     if ($cache) {
         //启用动态数据缓存
         if ($all) {
             $identify = $this->name . 'List_' . to_guid_string(func_get_args());
         } else {
             $identify = $this->name . '_' . to_guid_string($condition);
         }
         $result = S($identify);
         if (false !== $result) {
             if (!$all) {
                 $this->cacheLockVersion($result);
             }
             // 后置调用
             $this->_after_read($condition, $result);
             return $result;
         }
     }
     if ($this->viewModel) {
         $condition = $this->checkCondition($condition);
         $fields = $this->checkFields($fields);
         $order = $this->checkOrder($order);
         $group = $this->checkGroup($group);
     }
     $lazy = $this->lazyQuery || $lazy;
     $lock = $this->pessimisticLock || $lock;
     $rs = $this->db->find($condition, $table, $fields, $order, $limit, $group, $having, $join, $cache, $lazy, $lock);
     $result = $this->rsToVo($rs, $all, 0, $relation);
     // 后置调用
     $this->_after_read($condition, $result);
     if ($result && $cache) {
         S($identify, $result);
     }
     return $result;
 }
开发者ID:skiman100,项目名称:thinksns,代码行数:80,代码来源:Model.class.php

示例11: get_instance_of

/**
 * 取得对象实例 支持调用类的静态方法
 * @param string $name 类名
 * @param string $method 方法名,如果为空则返回实例化对象
 * @param array $args 调用参数
 * @return object
 */
function get_instance_of($name, $method = '', $args = array())
{
    static $_instance = array();
    $identify = empty($args) ? $name . $method : $name . $method . to_guid_string($args);
    if (!isset($_instance[$identify])) {
        if (class_exists($name)) {
            $o = new $name();
            if (method_exists($o, $method)) {
                if (!empty($args)) {
                    $_instance[$identify] = call_user_func_array(array(&$o, $method), $args);
                } else {
                    $_instance[$identify] = $o->{$method}();
                }
            } else {
                $_instance[$identify] = $o;
            }
        } else {
            halt(L('_CLASS_NOT_EXIST_') . ':' . $name);
        }
    }
    return $_instance[$identify];
}
开发者ID:omusico,项目名称:MRFOS,代码行数:29,代码来源:functions.php

示例12: top

 /**
  * 排行榜 (top) 
  * 参数名	 是否必须	 默认值	 说明
  * num	 否	 10	 返回数量
  * order	 否	 hits DESC	 排序类型
  */
 public function top($data)
 {
     //缓存时间
     $cache = (int) $data['cache'];
     $cacheID = to_guid_string($data);
     if ($cache && ($return = S($cacheID))) {
         return $return;
     }
     $num = $data['num'] ? $data['num'] : 10;
     $order = array("hits" => "DESC");
     if ($data['order']) {
         $order = $data['order'];
     }
     $where = array();
     //设置SQL where 部分
     if (isset($data['where']) && $data['where']) {
         $where['_string'] = $data['where'];
     }
     $return = $this->db->where($where)->order($order)->limit($num)->select();
     //增加访问路径
     foreach ($return as $k => $v) {
         $url = ShuipFCMS()->Url->tags($v);
         $return[$k]['url'] = $url['url'];
     }
     if ($cache) {
         S($cacheID, $return, $cache);
     }
     return $return;
 }
开发者ID:sandom123,项目名称:king400,代码行数:35,代码来源:Tags.class.php

示例13: category

 /**
  * 栏目列表(category)
  * 参数名	 是否必须	 默认值	 说明
  * catid	 否	 0	 调用该栏目下的所有栏目 ,默认0,调用一级栏目
  * order	 否	 null	 排序方式、一般按照listorder ASC排序,即栏目的添加顺序
  * @param $data
  */
 public function category($data)
 {
     //缓存时间
     $cache = (int) $data['cache'];
     $cacheID = to_guid_string($data);
     if ($cache && ($array = S($cacheID))) {
         return $array;
     }
     $data['catid'] = intval($data['catid']);
     $where = $array = array();
     //设置SQL where 部分
     if (isset($data['where']) && $data['where']) {
         $where['_string'] = $data['where'];
     }
     $db = M('Category');
     $num = (int) $data['num'];
     if (isset($data['catid'])) {
         $where['ismenu'] = 1;
         $where['parentid'] = $data['catid'];
     }
     //如果条件不为空,进行查库
     if (!empty($where)) {
         if ($num) {
             $categorys = $db->where($where)->limit($num)->order($data['order'])->select();
         } else {
             $categorys = $db->where($where)->order($data['order'])->select();
         }
     }
     //结果进行缓存
     if ($cache) {
         S($cacheID, $categorys, $cache);
     }
     return $categorys;
 }
开发者ID:sandom123,项目名称:king400,代码行数:41,代码来源:Content.class.php

示例14: _navigate

 /**
  * 导航标签
  * 使用方法:
  *      用法示例:<navigate catid="$catid" space=" &gt; " />
  * 参数说明:
  *          @catid		栏目id,可以传入数字,也可以传递变量 $catid
  *          @space		分隔符,支持html代码
  *          @blank		是否新窗口打开
  *          @cache                              缓存时间
  * @staticvar array $_navigateCache
  * @param type $attr 标签属性
  * @param type $content 表情内容
  * @return array|string
  */
 public function _navigate($tag, $content)
 {
     $key = to_guid_string(array($tag, $content));
     $cache = (int) $tag['cache'];
     if ($cache) {
         $data = S($key);
         if ($data) {
             return $data;
         }
     }
     //分隔符,支持html代码
     $space = !empty($tag['space']) ? $tag['space'] : '&gt;';
     //是否新窗口打开
     $target = !empty($tag['blank']) ? ' target="_blank" ' : '';
     $catid = $tag['catid'];
     $parsestr = '';
     //如果传入的是纯数字
     if (is_numeric($catid)) {
         $catid = (int) $catid;
         if (getCategory($catid) == false) {
             return '';
         }
         //获取当前栏目的 父栏目列表
         $arrparentid = array_filter(explode(',', getCategory($catid, 'arrparentid') . ',' . $catid));
         foreach ($arrparentid as $cid) {
             $parsestr[] = '<a href="' . getCategory($cid, 'url') . '" ' . $target . '>' . getCategory($cid, 'catname') . '</a>';
         }
         $parsestr = implode($space, $parsestr);
     } else {
         $parsestr = '';
         $parsestr .= '<?php';
         $parsestr .= '  $arrparentid = array_filter(explode(\',\', getCategory(' . $catid . ',"arrparentid") . \',\' . ' . $catid . ')); ';
         $parsestr .= '  foreach ($arrparentid as $cid) {';
         $parsestr .= '      $parsestr[] = \'<a href="\' . getCategory($cid,\'url\')  . \'" ' . $target . '>\' . getCategory($cid,\'catname\') . \'</a>\';';
         $parsestr .= '  }';
         $parsestr .= '  echo  implode("' . $space . '", $parsestr);';
         $parsestr .= '?>';
     }
     if ($cache) {
         S($key, $parsestr, $cache);
     }
     return $parsestr;
 }
开发者ID:sandom123,项目名称:king400,代码行数:57,代码来源:Shuipf.class.php

示例15: _read

 /**
 +----------------------------------------------------------
 * 数据库Read操作入口
 +----------------------------------------------------------
 * @access private 
 +----------------------------------------------------------
 * @param mixed $condition 查询条件
 * @param string $fields 查询字段
 * @param boolean $all 是否返回多个数据
 * @param string $order 
 * @param string $limit 
 * @param string $group 
 * @param string $having 
 * @param string $join 
 * @param boolean $cache 是否查询缓存
 * @param boolean $relation 是否关联查询
 * @param boolean $lazy 是否惰性查询
 * @param boolean $lock 是否加锁
 +----------------------------------------------------------
 * @return boolean
 +----------------------------------------------------------
 */
 private function _read($condition, $fields = '*', $all = false, $order = '', $limit = '', $group = '', $having = '', $join = '', $cache = false, $relation = false, $lazy = false, $lock = false)
 {
     // 前置调用
     if (!$this->_before_read($condition)) {
         // 如果返回false 中止
         return false;
     }
     if ($all) {
         $identify = $this->name . 'List_' . to_guid_string(func_get_args());
     } else {
         $identify = $this->name . '_' . to_guid_string($condition);
     }
     if ($cache) {
         //启用动态数据缓存
         $result = S($identify);
         if (false !== $result) {
             if (!$all) {
                 $this->cacheLockVersion($result);
             }
             // 后置调用
             $this->_after_read($condition, $result);
             return $result;
         }
     }
     if ($this->viewModel) {
         $condition = $this->checkCondition($condition);
         $fields = $this->checkFields($fields);
         $order = $this->checkOrder($order);
         $group = $this->checkGroup($group);
     }
     $lazy = $this->lazyQuery || $lazy;
     $lock = $this->pessimisticLock || $lock;
     $rs = $this->db->find($condition, $this->getTableName(), $fields, $order, $limit, $group, $having, $join, $cache, $lazy, $lock);
     $result = $this->rsToVo($rs, $all, 0, $relation);
     // 后置调用
     $this->_after_read($condition, $result);
     if ($result && $cache) {
         S($identify, $result);
     }
     return $result;
 }
开发者ID:BGCX262,项目名称:zxzjob-svn-to-git,代码行数:63,代码来源:Model.class.php


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