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


PHP guid函数代码示例

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


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

示例1: useradd

 /**
  * 新增用户
  * 
  */
 public function useradd()
 {
     if ('POST' == I('server.REQUEST_METHOD')) {
         $User = M('User');
         $data = $_POST;
         switch ($data['status']) {
             case '1':
                 $data['status'] = 1;
                 break;
             default:
                 $data['status'] = 0;
         }
         $data['password'] = md5($_POST['password']);
         $data['create_time'] = date('Ymd H:i:s');
         $data['update_time'] = date('Ymd H:i:s');
         $data['remark'] = 'dd';
         $data['last_login_ip'] = get_client_ip();
         $data['token'] = guid();
         $data['id'] = null;
         if (!$User->create($data)) {
             $this->error($User->getError());
         } else {
             if ($result = $User->add()) {
                 $this->crmSuccess('添加成功', U('index'));
             } else {
                 $this->crmError('添加失败', U('useradd'));
             }
         }
     } else {
         $this->display();
     }
 }
开发者ID:yuhaizr,项目名称:Y2Game,代码行数:36,代码来源:UserController.class.php

示例2: execute

 public function execute()
 {
     $request = $_REQUEST;
     $data = $request['data'];
     if (empty($data)) {
         throw new Exception('Missing Data');
     }
     if (empty($data['uid'])) {
         throw new Exception('Missing Uid');
     }
     if (empty($data['to_uid'])) {
         throw new Exception('Missing to user id');
     }
     if (empty($data['subject'])) {
         throw new Exception('Missing subject');
     }
     if (empty($data['message'])) {
         throw new Exception('Missing message');
     }
     $message_id = guid();
     $data['message_id'] = $message_id;
     $Models_Messages = new Models_Messages();
     $Models_Messages->add($data);
     $this->return = array('confirm' => 'Message sent successfully.', 'message_id' => $message_id);
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:25,代码来源:add.class.php

示例3: register

 public function register($username, $password, $email, $phone, $name)
 {
     global $connAdodb;
     $sql = "select * from users where (username = " . $connAdodb->qstr($username) . " OR phone = " . $connAdodb->qstr($phone) . " OR email = " . $connAdodb->qstr($email) . ")";
     $rs = $connAdodb->Execute($sql);
     if ($rs->RecordCount() === 0) {
         //insert here
         $return['username'] = $username;
         $return['password'] = $password;
         $return['email'] = $email;
         $return['phone'] = $phone;
         $return['name'] = $name;
         $return['user_id'] = guid();
         $return['status'] = 1;
         $return['created'] = tstobts(time());
         $connAdodb->AutoExecute('users', $return, 'INSERT');
         unset($return['password']);
         return $return;
     }
     if ($rs->fields['username'] == $username) {
         return 0;
     }
     if ($rs->fields['email'] == $email) {
         return 1;
     }
     if ($rs->fields['phone'] == $phone) {
         return 2;
     }
     return 3;
 }
开发者ID:manishkhanchandani,项目名称:world_mkgxy,代码行数:30,代码来源:Users.class.php

示例4: insertCmsSite

 public function insertCmsSite()
 {
     foreach ($this->sites as $v) {
         $arr = array();
         $a = $style = '';
         if (!empty($v['ResourcePSN'])) {
             $a = explode('}', $v['ResourcePSN']);
             $a = substr($a[0], 5);
             $arr['domain'] = $this->psn[$a]['URL'];
             $arr['dirname'] = $this->dir[$v['Name']];
         } else {
             $arr['domain'] = '';
             $arr['dirname'] = "html_{$v['NodeID']}";
         }
         $arr['siteid'] = $v['NodeID'];
         $arr['name'] = $v['Name'];
         $arr['site_title'] = $v['Name'];
         $arr['uuid'] = guid();
         $arr['setting'] = $this->setting;
         if (!empty($v['IndexTpl'])) {
             $v['IndexTpl'] = ltrim($v['IndexTpl'], "/");
             $a = explode("/", $v['IndexTpl']);
             $style = array_shift($a);
         } else {
             $style = 'default';
         }
         $arr['default_style'] = $style;
         //$arr['template'] = array($style);
         $arr['template'] = array('default');
         $res[] = $arr;
     }
     return $res;
 }
开发者ID:lestatmq,项目名称:cms,代码行数:33,代码来源:sites.php

示例5: guid

 /**
  * guid
  *
  * @return string(int)
  */
 public static function guid()
 {
     static $list = array();
     $time = explode(' ', microtime());
     // 1338438896 => 2012-05-31 12:34:56
     $guid = $time[1] - 1338438896 . sprintf('%06u', substr($time[0], 2, 6)) . substr(sprintf('%010u', mt_rand()), 0, 4);
     return isset($list[$guid]) ? guid() : ($list[$guid] = $guid);
 }
开发者ID:null-1,项目名称:fangtaitong,代码行数:13,代码来源:Util.php

示例6: add

 function add($points, $itemId)
 {
     if ($points == null || $itemId == null) {
         return false;
     }
     $remarkId = guid();
     self::$model->getDatabase()->execute("INSERT INTO `njx_remarks` SET `remarkId`=?,`points`=?,`itemId`=?", array($remarkId, $points, $itemId));
     return $this->selectOne($remarkId);
 }
开发者ID:shiyake,项目名称:PHP,代码行数:9,代码来源:RemarksModel.php

示例7: agregarFamilia

 public function agregarFamilia()
 {
     $datos_familia = array('id' => guid(), 'nombre' => $this->input->post('nombre'), 'descripcion' => $this->input->post('descripcion'), 'estado' => TRUE);
     if ($this->familias->agregar((object) $datos_familia)) {
         echo json_encode(TRUE);
     } else {
         echo json_encode(FALSE);
     }
 }
开发者ID:mxcoding,项目名称:sosbelladev,代码行数:9,代码来源:familias.php

示例8: agregarCategoria

 public function agregarCategoria()
 {
     $categoria = array('idCategoria' => guid(), 'nombre' => $this->input->post('nombre'), 'descripcion' => $this->input->post('descripcion'), 'idFamilia' => $this->input->post('familia'));
     if ($this->categorias->agregar((object) $categoria)) {
         echo json_encode(TRUE);
     } else {
         echo json_encode(FALSE);
     }
 }
开发者ID:mxcoding,项目名称:sosbelladev,代码行数:9,代码来源:categorias.php

示例9: add

 function add($name, $type, $tips = null, $selectorCount = null, $rangeFrom = null, $rangeTo = null, $rangeUnit = null)
 {
     if ($name == null || $type == null) {
         return false;
     }
     $foid = guid();
     self::$model->getDatabase()->execute("INSERT INTO `njx_fields_options` SET `foid`=?,`name`=?,`tips`=?,`type`=?,`selectorCount`=?,`rangeFrom`=?,`rangeTo`=?,`rangeUnit`=?", array($foid, $name, $tips, $type, $selectorCount, $rangeFrom, $rangeTo, $rangeUnit));
     return $this->selectOne($foid);
 }
开发者ID:shiyake,项目名称:PHP,代码行数:9,代码来源:FieldsOptionsModel.php

示例10: add

 function add($name, $value)
 {
     if ($name == null || $value == null) {
         return false;
     }
     $sid = guid();
     self::$model->getDatabase()->execute("INSERT INTO `njx_setting` SET `sid`=?,`name`=?,`value`=?", array($sid, $name, $value));
     return $this->selectOne($sid);
 }
开发者ID:shiyake,项目名称:PHP,代码行数:9,代码来源:SettingModel.php

示例11: add

 function add($foid, $value, $itemId)
 {
     if ($foid == null || $value == null || $itemId == null) {
         return false;
     }
     $oid = guid();
     self::$model->getDatabase()->execute("INSERT INTO `njx_fields` SET `oid`=?,`foid`=?,`value`=?,`itemId`=?", array($oid, $foid, $value, $itemId));
     return $this->selectOne($oid);
 }
开发者ID:shiyake,项目名称:PHP,代码行数:9,代码来源:FieldsModel.php

示例12: add

 function add($content, $image, $url)
 {
     if ($content == null || $image == null || $url == null) {
         return false;
     }
     $aid = guid();
     $display = 1;
     self::$model->getDatabase()->execute("INSERT INTO `njx_ads` SET `aid`=?,`content`=?,`image`=?,`url`=?,`display`=?", array($aid, $content, $image, $url, $display));
     return $this->selectOne($aid);
 }
开发者ID:shiyake,项目名称:PHP,代码行数:10,代码来源:AdsModel.php

示例13: add

 function add($discuzId, $name, $privilege)
 {
     if ($discuzId == null || $name == null || $privilege == null) {
         return false;
     }
     $uid = guid();
     $createTime = date('H-m-d H:i:s', time());
     self::$model->getDatabase()->execute("INSERT INTO `njx_users` SET `uid`=?,`discuzId`=?,`createTime`=?,`name`=?,`privilege`=?", array($uid, $discuzId, $createTime, $name, $privilege));
     return $this->selectOne($uid);
 }
开发者ID:shiyake,项目名称:PHP,代码行数:10,代码来源:UsersModel.php

示例14: add

 function add($itemId, $content)
 {
     if ($itemId == null || $content == null) {
         return false;
     }
     $rid = guid();
     $currentTime = date('Y-m-d H:i:s', time());
     echo $currentTime;
     self::$model->getDatabase()->execute("INSERT INTO `njx_comments` SET `rid`=?,`itemId`=?,`content`=?,`createTime`=?", array($rid, $itemId, $content, $currentTime));
     return $this->selectOne($rid);
 }
开发者ID:shiyake,项目名称:PHP,代码行数:11,代码来源:CommentsModel.php

示例15: create

 public function create()
 {
     $authinfo = $this->input['authinfo'];
     $authinfo['status'] = 0;
     $authinfo['appkey'] = guid('');
     $re = $this->customcore->create('authinfo', $authinfo);
     $custominfo = $this->input['custominfo'];
     $custominfo['appid'] = $re['id'];
     $this->customcore->create('custominfo', $custominfo);
     $this->addItem('true');
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:12,代码来源:custom_manage_update.php


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