當前位置: 首頁>>代碼示例>>PHP>>正文


PHP S函數代碼示例

本文整理匯總了PHP中S函數的典型用法代碼示例。如果您正苦於以下問題:PHP S函數的具體用法?PHP S怎麽用?PHP S使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了S函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: site

 /**
  * 站點設置
  */
 public function site()
 {
     if (IS_POST) {
         $setting_db = D('Setting');
         if (I('get.dosubmit')) {
             $state = $setting_db->dosave($_POST['data']);
             $state ? $this->success('操作成功') : $this->error('操作失敗');
         } else {
             if (S('setting_site')) {
                 $data = S('setting_site');
             } else {
                 $data = $setting_db->getSetting();
                 S('setting_site', $data);
             }
             $this->ajaxReturn($data);
         }
     } else {
         $menu_db = D('Menu');
         $currentpos = $menu_db->currentPos(I('get.menuid'));
         //欄目位置
         $propertygrid = array('options' => array('title' => $currentpos, 'url' => U('Setting/site', array('grid' => 'propertygrid')), 'toolbar' => 'setting_site_propertygrid_toolbar'));
         $this->assign('propertygrid', $propertygrid);
         $this->display();
     }
 }
開發者ID:qingchengdelaike,項目名稱:369daohang_com_aqi_map,代碼行數:28,代碼來源:SettingController.class.php

示例2: getName

function getName($number, $pwd)
{
    $TRY_TIMES = 10;
    S(array('prefix' => 'verify', 'expire' => 3 * $TRY_TIMES));
    $verify_array = S('verify_array');
    if (!$verify_array) {
        $verify_array = array();
    }
    if (!in_array($number, $verify_array)) {
        array_push($verify_array, $number);
    } else {
        return false;
    }
    S('verify_' . $number, $pwd);
    S('verify_array', $verify_array);
    $i = 0;
    while ($i++ < $TRY_TIMES && S('verify_' . $number) == $pwd) {
        sleep(1);
    }
    $name = S('verify_' . $number);
    S(array('prefix' => ''));
    if ($i < $TRY_TIMES && $name != '0') {
        return $name;
    } else {
        return false;
    }
}
開發者ID:noikiy,項目名稱:print,代碼行數:27,代碼來源:NankaiInside.php

示例3: index

 public function index()
 {
     /* 下載鏈接 */
     $vo['data_setting'] = S('data_setting');
     $this->assign('vo', $vo);
     $this->display();
 }
開發者ID:liqihua,項目名稱:yanzhihui,代碼行數:7,代碼來源:IndexController.class.php

示例4: do_data

 /**
  * 讀取數據 do_data
  */
 public function do_data()
 {
     $topic_id = I('get.id');
     /* 判斷是否存在緩存 */
     $cache = S('HOME_TOPIC_ARTICLE_ID_' . $topic_id);
     if ($cache) {
         $data = $cache;
     } else {
         /* 查詢條件 */
         $field = 'topic.id as topic_id,topic.upfile,topic.content,topic.province,topic.city,topic.create_time,
                   user.nick_name,user.sex,user.upfile_head as user_upfile_head';
         $where['topic.id'] = array('EQ', $topic_id);
         $where['topic.status'] = array('EQ', 1);
         $where['topic.display'] = array('EQ', 1);
         $where['user.status'] = array('EQ', 1);
         $where['user.display'] = array('EQ', 1);
         /* 查詢數據 */
         $data = $this->alias('topic')->field($field)->where($where)->join('__USER__ user on topic.user_id = user.id')->find();
         /* 讀取用戶頭像 */
         if ($data['user_upfile_head'] && !strstr($data['user_upfile_head'], 'http://')) {
             $data['user_upfile_head'] = C('APP_URL') . '/Uploads/Images/User/' . $data['user_upfile_head'];
         }
         /* 轉換數據 */
         if ($data['content']) {
             $data['content'] = urldecode($data['content']);
         }
         /* 設置緩存 */
         S('HOME_TOPIC_ARTICLE_ID_' . $topic_id, $data, C('CACHE_TIME'));
     }
     /* 下載鏈接 */
     $data['data_setting'] = S('data_setting');
     return $data;
 }
開發者ID:liqihua,項目名稱:yanzhihui,代碼行數:36,代碼來源:TopicModel.class.php

示例5: run

 /**
  * @param mixed $content
  */
 public function run(&$content)
 {
     /**
      *  //真不知道說什麽好。。。
      *      這裏      原因是tp 不能把tag放在項目配置中,隻能放在common中,而common模塊先於install 初始化
      *     so。。。。。
      *
      */
     if (C('DB_TYPE') == 'GreenCMS_DB_TYPE') {
     } else {
         if (isset($_GET['m']) && strtolower($_GET['m']) == 'install') {
             return;
         }
         $data = S('hooks');
         if (!$data) {
             $hooks = M('Hooks')->getField('name,addons');
             foreach ($hooks as $key => $value) {
                 if ($value) {
                     $map['status'] = 1;
                     $names = explode(',', $value);
                     $map['name'] = array('IN', $names);
                     $data = M('Addons')->where($map)->getField('id,name');
                     if ($data) {
                         $addons = array_intersect($names, $data);
                         Hook::add($key, $addons);
                     }
                 }
             }
             S('hooks', Hook::get());
         } else {
             Hook::import($data, false);
         }
     }
 }
開發者ID:zachdary,項目名稱:GreenCMS,代碼行數:37,代碼來源:InitHookBehavior.class.php

示例6: run

 public function run(&$params)
 {
     if (C('UPGRADE_NOTICE_ON') && (!S('think_upgrade_interval') || C('UPGRADE_NOTICE_DEBUG'))) {
         if (IS_SAE && C('UPGRADE_NOTICE_QUEUE') && !isset($_POST['think_upgrade_queque'])) {
             $queue = new SaeTaskQueue(C('UPGRADE_NOTICE_QUEUE'));
             $queue->addTask('http://' . $_SERVER['HTTP_HOST'] . __APP__, 'think_upgrade_queque=1');
             if (!$queue->push()) {
                 trace('升級提醒隊列執行失敗,錯誤原因:' . $queue->errmsg(), '升級通知出錯', 'NOTIC', true);
             }
             return;
         }
         $akey = C('UPGRADE_NOTICE_AKEY', null, '');
         $skey = C('UPGRADE_NOTICE_SKEY', null, '');
         $this->accesskey_ = $akey ? $akey : (defined('SAE_ACCESSKEY') ? SAE_ACCESSKEY : '');
         $this->secretkey_ = $skey ? $skey : (defined('SAE_SECRETKEY') ? SAE_SECRETKEY : '');
         $current_version = C('UPGRADE_CURRENT_VERSION', null, 0);
         //讀取接口
         $info = $this->send('http://sinaclouds.sinaapp.com/thinkapi/upgrade.php?v=' . $current_version);
         if ($info['version'] != $current_version) {
             if ($this->send_sms($info['msg'])) {
                 trace($info['msg'], '升級通知成功', 'NOTIC', true);
             }
             //發送升級短信
         }
         S('think_upgrade_interval', true, C('UPGRADE_NOTICE_CHECK_INTERVAL', null, 604800));
     }
 }
開發者ID:delyyfei,項目名稱:spreadshirt,代碼行數:27,代碼來源:UpgradeNoticeBehavior.class.php

示例7: edit

 public function edit($id = null)
 {
     if (IS_POST) {
         $FrindLink = D('WebFriendlink');
         $data = $FrindLink->create();
         if ($data) {
             if ($FrindLink->save()) {
                 S('h_i_friendlinks', null);
                 $this->success('更新成功');
             } else {
                 $this->error('更新失敗');
             }
         } else {
             $this->error($FrindLink->getError());
         }
     } else {
         $info = array();
         $info = M('WebFriendlink')->field(true)->find($id);
         if (false === $info) {
             $this->error('獲取配置信息錯誤');
         }
         $this->assign('info', $info);
         $this->display();
     }
 }
開發者ID:nullog,項目名稱:zhanglubao,代碼行數:25,代碼來源:FriendLinkController.class.php

示例8: comformPay

 private function comformPay($orderNo, $type, $payInfo)
 {
     $m = M('Company_order');
     \Log::DEBUG($orderNo);
     $opt['orderNo'] = $orderNo;
     $result = $m->where($opt)->find();
     if ($result) {
         if ($result['payInfo']) {
             return true;
         }
         if ($type == 'topup') {
             $option['payInfo'] = json_encode($payInfo);
             $option['state'] = 1;
             $option['id'] = $result['id'];
             $row = $m->save($option);
             S('pay_' . $orderNo, 1, 600);
             $topup = json_decode($result['goods'], true);
             $topupCount = intval($topup['amount']) + intval($topup['present']);
             $this->updateUserTopup($result['uId'], $topupCount);
             $log = array("userId" => $result['uId'], "amount" => $topup['amount'], "present" => $topup['present'], "topuptime" => date("Y-m-d H:i:s"), "payType" => 'wechat', "orderNo" => $orderNo);
             $this->topupLog($log);
         }
         if ($type == 'goods') {
             $payTemp = json_decode($result['payTemp']['items'], true);
             $payTemp[count($payTemp)] = $payInfo;
             $option['payInfo'] = json_encode($payTemp);
             \Log::DEBUG($option['payInfo']);
             $option['state'] = 1;
             $option['id'] = $result['id'];
             $row = $m->save($option);
             S('pay_' . $orderNo, 1, 600);
             $this->sendOrderMsg($result);
         }
     }
 }
開發者ID:superSN,項目名稱:tyrolland,代碼行數:35,代碼來源:Notify.class.php

示例9: loadAddons

 private function loadAddons()
 {
     $data = S('hooks');
     if (!$data) {
         $hooks = M('hooks')->getField('name,addons', true);
         foreach ($hooks as $key => $value) {
             if ($value) {
                 $map['status'] = 1;
                 $names = explode(',', $value);
                 $map['name'] = array('IN', $names);
                 $data = M('Addons')->where($map)->getField('id,name');
                 if ($data) {
                     $addons = array_intersect($names, $data);
                     Hook::add($key, $addons);
                 }
             }
         }
         S('hooks', Hook::get());
         //插件標簽
         $tpl_tags = array();
         $data = M('addons')->getField('id,name');
         if ($data) {
             foreach ($data as $addon) {
                 if (is_file("HDCMS/Addons/{$addon}/Tag/{$addon}Tag.class.php")) {
                     $tpl_tags[] = "@.Addons.{$addon}.Tag.{$addon}Tag";
                 }
             }
         }
         S('HookTag', array_unique($tpl_tags));
     } else {
         Hook::import($data, false);
         C('TPL_TAGS', array_unique(array_merge(C('TPL_TAGS'), S('HookTag'))));
     }
 }
開發者ID:lililishuang,項目名稱:hdcms,代碼行數:34,代碼來源:AppInitHook.class.php

示例10: type_list

 /**
  * 獲取友情鏈接列表(type_list)
  * 參數名	 是否必須	 默認值	 說明
  * order	 是	 id DESC	 排序方式
  * termsid	 否	 null	 分類ID
  * id	 否	 null	 鏈接ID 
  */
 public function type_list($data)
 {
     //緩存時間
     $cache = (int) $data['cache'];
     $cacheID = md5(implode(",", $data));
     $cacheData = S($cacheID);
     if ($cache && $cacheData) {
         return $cacheData;
     }
     $termsid = (int) $data['termsid'];
     $id = (int) $data['id'];
     $num = empty($data['num']) ? 10 : (int) $data['num'];
     $order = empty($data['order']) ? "id DESC" : $data['order'];
     $db = M("Links");
     $where = array();
     if ($id > 0) {
         $where['id'] = array("EQ", $id);
         $data = $db->where($where)->find();
     } else {
         if ($termsid > 0) {
             $where['termsid'] = array("EQ", $termsid);
             $data = $db->where($where)->order($order)->limit($num)->select();
         }
     }
     //結果進行緩存
     if ($cache) {
         S($cacheID, $data, $cache);
     }
     return $data;
 }
開發者ID:BGCX262,項目名稱:ztoa-svn-to-git,代碼行數:37,代碼來源:LinksTagLib.class.php

示例11: _getRelatedZhanggui

 /**
  * 獲取用戶的相關數據
  *
  * @param array $data
  *        	配置相關數據
  * @return array 顯示所需數據
  */
 private function _getRelatedZhanggui($data)
 {
     // 用戶ID
     $var['uid'] = isset($data['uid']) ? intval($data['uid']) : $GLOBALS['ts']['mid'];
     // 顯示相關人數
     $var['limit'] = isset($data['limit']) ? intval($data['limit']) : 4;
     // 掌櫃信息
     $key = '_getRelatedZhanggui' . $var['uid'] . '_' . $var['limit'] . '_' . date('Ymd');
     $var['user'] = S($key);
     if ($var['user'] === false || intval($_REQUEST['rel']) == 1) {
         $sql = "SELECT uid FROM `ts_user_verified` WHERE usergroup_id=5 AND verified=1 order by rand() limit " . $var['limit'];
         $list = M()->query($sql);
         // 			dump($list);
         $uids = getSubByKey($list, 'uid');
         $userInfos = model('User')->getUserInfoByUids($uids);
         $userStates = model('Follow')->getFollowStateByFids($GLOBALS['mid'], $uids);
         foreach ($list as $v) {
             $key = $v['uid'];
             $arr[$key]['userInfo'] = $userInfos[$key];
             $arr[$key]['followState'] = $userStates[$key];
             $arr[$key]['info']['msg'] = '掌櫃';
             $arr[$key]['info']['extendMsg'] = '';
         }
         $var['user'] = $arr;
         S($key, $var['user'], 86400);
         // 			S ( 'now_'.$key, $var ['user'], 86400 );
     }
     // 		dump($var);
     return $var;
 }
開發者ID:omusico,項目名稱:ThinkSNS-4,代碼行數:37,代碼來源:RelatedZhangguiWidget.class.php

示例12: _makeTree

 public function _makeTree($pid)
 {
     if ($pid == 0 && ($cache = S('Cache_Group_Cate_' . $pid))) {
         // pid=0 才緩存
         return $cache;
     }
     if ($c = $this->where("pid='{$pid}'")->findAll()) {
         if ($pid == 0) {
             foreach ($c as $v) {
                 $cTree['t'] = $v['title'];
                 $cTree['a'] = $v['id'];
                 $cTree['d'] = $this->_makeTree($v['id']);
                 $cTrees[] = $cTree;
             }
         } else {
             foreach ($c as $v) {
                 $cTree['t'] = $v['title'];
                 $cTree['a'] = $v['id'];
                 $cTree['d'] = '';
                 //$v['id'];
                 $cTrees[] = $cTree;
             }
         }
     }
     $pid == 0 && S('Cache_Group_Cate_' . $pid, $cTrees);
     // pid=0 才緩存
     return $cTrees;
 }
開發者ID:yang7hua,項目名稱:hunshe,代碼行數:28,代碼來源:CategoryModel.class.php

示例13: get_document_model

 /**
  * 獲取文檔模型信息
  * @param  integer $id    模型ID
  * @param  string  $field 模型字段
  * @return array
  */
 public static function get_document_model($id = null, $field = null)
 {
     static $list;
     /* 非法分類ID */
     if (!(is_numeric($id) || is_null($id))) {
         return '';
     }
     /* 讀取緩存數據 */
     if (empty($list)) {
         $list = S('DOCUMENT_MODEL_LIST');
     }
     /* 獲取模型名稱 */
     if (empty($list)) {
         $map = array('status' => 1, 'extend' => 1);
         $model = M('Model')->where($map)->field(true)->select();
         foreach ($model as $value) {
             $list[$value['id']] = $value;
         }
         S('DOCUMENT_MODEL_LIST', $list);
         //更新緩存
     }
     /* 根據條件返回數據 */
     if (is_null($id)) {
         return $list;
     } elseif (is_null($field)) {
         return $list[$id];
     } else {
         return $list[$id][$field];
     }
 }
開發者ID:Germey,項目名稱:SimpleCMS,代碼行數:36,代碼來源:ModelApi.class.php

示例14: update

 /**
  * 新增或更新一個行為
  * @return boolean fasle 失敗 , int  成功 返回完整的數據
  * @author huajie <banhuajie@163.com>
  */
 public function update()
 {
     $action_rule = $_POST['action_rule'];
     for ($i = 0; $i < count($action_rule['table']); $i++) {
         $_POST['rule'][] = array('table' => $action_rule['table'][$i], 'field' => $action_rule['field'][$i], 'rule' => $action_rule['rule'][$i], 'cycle' => $action_rule['cycle'][$i], 'max' => $action_rule['max'][$i]);
     }
     $_POST['rule'] = serialize($_POST['rule']);
     /* 獲取數據對象 */
     $data = $this->create($_POST);
     if (empty($data)) {
         return false;
     }
     /* 添加或新增行為 */
     if (empty($data['id'])) {
         //新增數據
         $id = $this->add();
         //添加行為
         if (!$id) {
             $this->error = '新增行為出錯!';
             return false;
         }
     } else {
         //更新數據
         $status = $this->save();
         //更新基礎內容
         if (false === $status) {
             $this->error = '更新行為出錯!';
             return false;
         }
     }
     //刪除緩存
     S('action_list', null);
     //內容添加或更新完成
     return $data;
 }
開發者ID:admpub,項目名稱:OpenCenter,代碼行數:40,代碼來源:ActionModel.class.php

示例15: update

 /**
  * 新增或更新一個文檔
  * @return boolean fasle 失敗 , int  成功 返回完整的數據
  * @author Rocks
  */
 public function update()
 {
     /* 獲取數據對象 */
     $data = $this->create();
     if (empty($data)) {
         return false;
     }
     /* 添加或新增基礎內容 */
     if (empty($data['id'])) {
         //新增數據
         $id = $this->add();
         //添加基礎內容
         if (!$id) {
             $this->error = '新增模型出錯!';
             return false;
         }
     } else {
         //更新數據
         $status = $this->save();
         //更新基礎內容
         if (false === $status) {
             $this->error = '更新模型出錯!';
             return false;
         }
     }
     // 清除模型緩存數據
     S('DOCUMENT_MODEL_LIST', null);
     //記錄行為
     action_log('update_model', 'model', $data['id'] ? $data['id'] : $id, UID);
     //內容添加或更新完成
     return $data;
 }
開發者ID:nullog,項目名稱:zhanglubao,代碼行數:37,代碼來源:ModelModel.class.php


注:本文中的S函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。