本文整理汇总了PHP中iunserializer函数的典型用法代码示例。如果您正苦于以下问题:PHP iunserializer函数的具体用法?PHP iunserializer怎么用?PHP iunserializer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iunserializer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: receive
public function receive()
{
global $_W;
$type = $this->message['type'];
//这里定义此模块进行消息订阅时的, 消息到达以后的具体处理过程, 请查看WORMWOOD文档来编写你的代码
if ($type != "text" && $type != "image" && $type != "voice") {
return;
}
$file = IA_ROOT . '/source/modules/mechat/function.php';
if (!file_exists($file)) {
return array();
}
include_once $file;
$sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid";
$row = pdo_fetch($sql, array(':weid' => $_W['weid']));
if ($row) {
$pdata = array("ToUserName" => $this->message['tousername'], "FromUserName" => $this->message['fromusername'], "CreateTime" => $this->message['createtime'], "MsgType" => $this->message['msgtype'], "Content" => $this->message['content'], "MsgId" => $this->message['msgid']);
if ($type == "voice") {
$pdata["MsgType"] = "text";
$pdata["Content"] = "系统:微信公众号粉丝发送语音消息,系统暂不能接收请客服处理。";
}
$dat = array('unit' => $row["name"], 'msg' => json_encode($pdata));
$dat2 = iunserializer($row["cdata"]);
$actoken = account_mechat_token(array("weid" => $_W['weid'], "access_token" => $dat2["access_token"], "appid" => $dat2["appid"], "appsecret" => $dat2["appsecret"]));
$url = sprintf($this->gateway['mechat_receive'], $actoken);
$content = ihttp_post($url, $dat);
}
}
示例2: __construct
public function __construct()
{
global $_W;
$sql = 'SELECT `settings` FROM ' . tablename('uni_account_modules') . ' WHERE `uniacid` = :uniacid AND `module` = :module';
$settings = pdo_fetchcolumn($sql, array(':uniacid' => $_W['uniacid'], ':module' => 'feng_fightgroups'));
$this->settings = iunserializer($settings);
}
示例3: get_jsapi_ticket
/**
* 存储全局 jsapi_ticket
*
* @return
*/
public static function get_jsapi_ticket()
{
global $_W;
$item = pdo_fetch("SELECT jsapi_ticket FROM " . tablename('wechats') . " WHERE weid = :weid", array(':weid' => $weid));
$item = json_decode(iunserializer($item['jsapi_ticket']), 1);
$jsapi_ticket = isset($_W['account']['jsapi_ticket']['ticket']) ? $_W['account']['jsapi_ticket']['ticket'] : $item['ticket'];
$expire_time = isset($_W['account']['jsapi_ticket']['expire']) ? $_W['account']['jsapi_ticket']['expire'] : $item['expire'];
if ($expire_time < time()) {
$access_token = self::get_access_token();
$url = "http://api.weixin.qq.com/cgi-bin/ticket/getticket?type=1&access_token={$access_token}";
$arr = self::get_curl($url);
if (empty($arr['ticket']) || empty($arr['expires_in'])) {
message('获取微信公众号授权失败, 请稍后重试! 公众平台返回原始数据为: <br />' . $arr['errcode'] . $arr['errmsg']);
}
$record = array();
$record['ticket'] = $arr['ticket'];
//保存全局票据
$record['expire'] = time() + $arr['expires_in'];
//保存过期时间
$row = array();
$row['jsapi_ticket'] = iserializer($record);
//序列化保存
pdo_update('wechats', $row, array('weid' => $_W['weid']));
$_W['account']['jsapi_ticket']['ticket'] = $record['ticket'];
//写入全局
$_W['account']['jsapi_ticket']['expire'] = $record['expire'];
$ticket = $record['ticket'];
} else {
$ticket = $jsapi_ticket;
}
return $ticket;
}
示例4: getJsApiTicket
private function getJsApiTicket()
{
global $_W;
$data = array();
$wechat = pdo_fetch("SELECT access_token FROM " . tablename('wechats') . " WHERE weid = {$_W['weid']}");
$AccessToken = iunserializer($wechat['access_token']);
$now = time();
if ($AccessToken['expire'] < $now || !$AccessToken['ticket']) {
//失效时,从服务器获取最新的access_token和ticket
$res = ihttp_get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->appId}&secret={$this->appSecret}");
$content = @json_decode($res['content'], true);
$access_token = $content['access_token'];
$res1 = ihttp_get("https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token={$access_token}");
$content1 = @json_decode($res1['content'], true);
$ticket = $content1['ticket'];
$data['token'] = $access_token;
$data['expire'] = $now + 7000;
//是7200秒失效,这里取7000
$data['ticket'] = $ticket;
pdo_update("wechats", array('access_token' => serialize($data)), array('weid' => $_W['weid']));
} else {
$ticket = $AccessToken['ticket'];
}
return $ticket;
}
示例5: cache_load
/**
* 读取缓存,并将缓存加载至 $_W 全局变量中
* @param string $key 缓存键名,如果键名以:结束,则做为分组名称读取所有缓存
*
*/
function cache_load($key, $unserialize = false)
{
global $_W;
if (substr($key, -1) == ':') {
$data = cache_search($key);
foreach ($data as $k => $v) {
$tmp =& cache_global($k);
$tmp = $unserialize ? iunserializer($v) : $v;
}
return cache_global($key);
} else {
$data = cache_read($key);
if ($key == 'setting') {
$_W['setting'] = $data;
return $_W['setting'];
} elseif ($key == 'modules') {
$_W['modules'] = $data;
return $_W['modules'];
} else {
$tmp =& cache_global($key);
$tmp = $unserialize ? iunserializer($data) : $data;
return $unserialize ? iunserializer($data) : $data;
}
}
}
示例6: card_setting
function card_setting($uniacid = 0)
{
global $_W;
$uniacid = intval($uniacid);
if ($uniacid <= 0) {
$uniacid = $_W['uniacid'];
}
$data = pdo_get('mc_card', array('uniacid' => $uniacid));
if (empty($data)) {
return error(-1, '会员卡不存在或已经被删除');
}
if (!empty($data['color'])) {
$data['color'] = iunserializer($data['color']);
}
$data['color'] = iunserializer($data['color']);
$data['background'] = iunserializer($data['background']);
$data['fields'] = iunserializer($data['fields']);
$data['discount'] = iunserializer($data['discount']);
if (!empty($data['discount']) && $data['discount_type'] != 0) {
$discount = array();
foreach ($data['discount'] as $key => $val) {
$key_condition = 'condition_' . $data['discount_type'];
$key_discount = 'discount_' . $data['discount_type'];
$discount[$key] = array('condition' => $val[$key_condition], 'discount' => $data['discount_type'] == 1 ? $val[$key_discount] : $val[$key_discount] / 10);
}
$data['discount'] = $discount;
}
$data['grant'] = iunserializer($data['grant']);
return $data;
}
示例7: module_build_privileges
function module_build_privileges()
{
$uniacid_arr = pdo_fetchall('SELECT uniacid, groupid FROM ' . tablename('uni_account'));
foreach ($uniacid_arr as $uniacid) {
if (empty($uniacid['groupid'])) {
$modules = pdo_fetchall("SELECT name FROM " . tablename('modules') . " WHERE issystem = 1 ORDER BY issystem DESC, mid ASC", array(), 'name');
} elseif ($uniacid['groupid'] == '-1') {
$modules = pdo_fetchall("SELECT name FROM " . tablename('modules') . " ORDER BY issystem DESC, mid ASC", array(), 'name');
} else {
$wechatgroup = pdo_fetch("SELECT `modules` FROM " . tablename('uni_group') . " WHERE id = '{$uniacid['groupid']}'");
$ms = '';
if (!empty($wechatgroup['modules'])) {
$wechatgroup['modules'] = iunserializer($wechatgroup['modules']);
if (!empty($wechatgroup['modules'])) {
$ms = implode("','", array_keys($wechatgroup['modules']));
$ms = " OR `name` IN ('{$ms}')";
}
}
$modules = pdo_fetchall("SELECT name FROM " . tablename('modules') . " WHERE issystem = 1{$ms} ORDER BY issystem DESC, mid ASC", array(), 'name');
}
$modules = array_keys($modules);
$mymodules = pdo_fetchall("SELECT `module` FROM " . tablename('uni_account_modules') . " WHERE uniacid = '{$uniacid['uniacid']}' ORDER BY enabled DESC ", array(), 'module');
$mymodules = array_keys($mymodules);
foreach ($modules as $module) {
if (!in_array($module, $mymodules)) {
$data['uniacid'] = $uniacid['uniacid'];
$data['module'] = $module;
$data['enabled'] = in_array($module, array('basic', 'news', 'userapi', 'music')) ? 1 : 0;
$data['settings'] = '';
pdo_insert('uni_account_modules', $data);
}
}
}
return true;
}
示例8: fieldsFormDisplay
public function fieldsFormDisplay($rid = 0)
{
load()->model('mc');
global $_W, $_GPC;
//要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0
$creditnames = uni_setting($_W['uniacid'], array('creditnames'));
if ($creditnames) {
foreach ($creditnames['creditnames'] as $index => $creditname) {
if ($creditname['enabled'] == 0) {
unset($creditnames['creditnames'][$index]);
}
}
$scredit = implode(', ', array_keys($creditnames['creditnames']));
} else {
$scredit = '';
}
$groups = mc_groups($_W['uniacid']);
$couponlists = pdo_fetchall('SELECT couponid,title,type,credittype,credit,endtime,amount,dosage FROM ' . tablename('activity_coupon') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC ', array(':uniacid' => $_W['uniacid'], ':type' => 1, ':endtime' => TIMESTAMP));
$tokenlists = pdo_fetchall('SELECT couponid,title,type,credittype,credit,endtime,amount,dosage FROM ' . tablename('activity_coupon') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC ', array(':uniacid' => $_W['uniacid'], ':type' => 2, ':endtime' => TIMESTAMP));
$goodslists = pdo_fetchall('SELECT id,title,type,credittype,endtime,total,num,credit FROM ' . tablename('activity_exchange') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC', array(':uniacid' => $_W['uniacid'], ':type' => 3, ':endtime' => TIMESTAMP));
//print_r($couponlists);
load()->func('tpl');
if ($rid == 0) {
$reply = array('title' => '幸运大抽奖活动开始了!', 'description' => '幸运大抽奖活动开始啦!', 'tips' => '每次抽奖需要花费50积分,一等奖为39元的现金抵扣券,二等奖为100积分,三等奖为50积分,四等奖为30积分。每人每天限抽2次。', 'remark' => '中奖积分请到会员主页查看', 'starttime' => time(), 'endtime' => time() + 10 * 84400, 'reg' => '0', 'status' => '1', 'awardnum' => '1', 'playnum' => '5', 'dayplaynum' => '1', 'zfcs' => '1', 'zjcs' => '1', 'rate' => '10', 'need_type' => 'credit1', 'need_num' => '0', 'give_type' => 'credit1', 'give_num' => '0', 'onlynone' => '1', 'share_title' => '欢迎参加幸运大抽奖活动', 'share_content' => '亲,欢迎参加幸运大抽奖活动,祝您好运哦!! 亲,需要绑定账号才可以参加哦');
$prizes = array('p1_type' => 'credit1');
} else {
$reply = pdo_fetch("SELECT * FROM " . tablename($this->table_reply) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
$prizes = iunserializer($reply['prizes']);
}
include $this->template('form');
}
示例9: receive
public function receive()
{
global $_W, $_GPC;
$type = $this->message['type'];
$uniacid = $_W['uniacid'];
$acid = $_W['acid'];
$openid = $this->message['from'];
$event = $this->message['event'];
$cfg = $this->module['config'];
file_put_contents(IA_ROOT . '/addons/fm_photosvote/test/fm_test.txt', iserializer($event));
if ($event == 'unsubscribe') {
$record = array('updatetime' => TIMESTAMP, 'follow' => '0', 'unfollowtime' => TIMESTAMP);
pdo_update('mc_mapping_fans', $record, array('openid' => $openid, 'acid' => $acid, 'uniacid' => $uniacid));
if ($cfg['isopenjsps']) {
$fmvotelog = pdo_fetchall("SELECT tfrom_user FROM " . tablename('fm_photosvote_votelog') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $openid, ':uniacid' => $uniacid));
foreach ($fmvotelog as $log) {
$fmprovevote = pdo_fetch("SELECT photosnum,hits FROM " . tablename('fm_photosvote_provevote') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $log['tfrom_user'], ':uniacid' => $uniacid));
pdo_update('fm_photosvote_provevote', array('lasttime' => TIMESTAMP, 'photosnum' => $fmprovevote['photosnum'] - 1, 'hits' => $fmprovevote['hits'] - 1), array('from_user' => $log['tfrom_user'], 'uniacid' => $uniacid));
}
pdo_delete('fm_photosvote_votelog', array('from_user' => $openid));
pdo_delete('fm_photosvote_bbsreply', array('from_user' => $openid));
}
} elseif ($event == 'subscribe') {
if ($cfg['oauthtype'] == 2) {
$wechats = pdo_fetch("SELECT * FROM " . tablename('account_wechats') . " WHERE uniacid = :uniacid ", array(':uniacid' => $_W['uniacid']));
$token = iunserializer($wechats['access_token']);
$arrlog = pdo_fetch("SELECT * FROM " . tablename('mc_mapping_fans') . " WHERE uniacid = :uniacid AND openid = :openid", array(':uniacid' => $_W['uniacid'], ':openid' => $openid));
$access_token = $token['token'];
$expire = $token['expire'];
if (time() >= $expire || empty($access_token)) {
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $wechats['key'] . "&secret=" . $wechats['secret'];
$html = file_get_contents($url);
$arr = json_decode($html, true);
$access_token = $arr['access_token'];
$record = array();
$record['token'] = $access_token;
$record['expire'] = time() + 3600;
$row = array();
$row['access_token'] = iserializer($record);
pdo_update('account_wechats', $row, array('uniacid' => $_W['uniacid']));
}
$url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $openid . "&lang=zh_CN";
$html = file_get_contents($url);
$re = @json_decode($html, true);
if (!empty($arrlog)) {
$data = array('nickname' => $re['nickname'], 'unionid' => $re['unionid']);
pdo_update('mc_mapping_fans', $data, array('openid' => $openid));
} else {
$default_groupid = pdo_fetchcolumn('SELECT groupid FROM ' . tablename('mc_groups') . ' WHERE uniacid = :uniacid AND isdefault = 1', array(':uniacid' => $_W['uniacid']));
$nickname = $re['nickname'];
$data = array('uniacid' => $_W['uniacid'], 'nickname' => $re['nickname'], 'avatar' => $re['headimgurl'], 'groupid' => $default_groupid, 'createtime' => TIMESTAMP);
pdo_insert('mc_members', $data);
$id = pdo_insertid();
$data = array('nickname' => $re['nickname'], 'unionid' => $re['unionid'], 'uid' => $id);
pdo_update('mc_mapping_fans', $data, array('openid' => $openid));
}
}
}
}
示例10: get_settings
function get_settings()
{
$value = pdo_fetchcolumn("SELECT value FROM " . tablename("core_settings") . " WHERE `key`=:key", array(":key" => "kim_financial"));
if (empty($value)) {
return array();
}
return @iunserializer($value);
}
示例11: __construct
public function __construct($uniAccount)
{
$this->account = $uniAccount;
if (empty($this->account)) {
trigger_error('error uniAccount id, can not construct ' . __CLASS__, E_USER_WARNING);
}
$this->account['access_token'] = iunserializer($this->account['access_token']);
}
示例12: fieldsFormDisplay
public function fieldsFormDisplay($rid = 0)
{
global $_W;
$uniacid = $_W['uniacid'];
load()->func('tpl');
$creditnames = array();
$unisettings = uni_setting($uniacid, array('creditnames'));
foreach ($unisettings['creditnames'] as $key => $credit) {
if (!empty($credit['enabled'])) {
$creditnames[$key] = $credit['title'];
}
}
if (!empty($rid)) {
$reply = pdo_fetch("SELECT * FROM " . tablename('stonefish_planting_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
$share = pdo_fetchall("SELECT * FROM " . tablename('stonefish_planting_share') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
$prize = pdo_fetchall("SELECT * FROM " . tablename('stonefish_planting_prize') . " WHERE rid = :rid ORDER BY `id` asc", array(':rid' => $rid));
//查询奖品是否可以删除
foreach ($prize as $mid => $prizes) {
$prize[$mid]['fans'] = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('stonefish_planting_award') . " WHERE prizetype = :prizeid", array(':prizeid' => $prizes['id']));
$prize[$mid]['delete_url'] = $this->createWebUrl('deleteprize', array('rid' => $rid, 'id' => $prizes['id']));
}
//查询奖品是否可以删除
}
$seed = pdo_fetchall("SELECT * FROM " . tablename('stonefish_planting_seed') . " WHERE uniacid = :uniacid Or uniacid = 0 ORDER BY `id` asc", array(':uniacid' => $uniacid));
if (!$reply) {
$now = time();
$reply = array("title" => "种值活动开始了!", "start_picurl" => "../addons/stonefish_planting/template/images/start.jpg", "description" => "欢迎参加种值活动", "repeat_lottery_reply" => "亲,继续努力哦~~", "ticket_information" => "请用力摇晃你的手机抽奖", "starttime" => $now, "endtime" => strtotime(date("Y-m-d H:i", $now + 7 * 24 * 3600)), "end_theme" => "种值活动已经结束了", "end_instruction" => "亲,活动已经结束,请继续关注我们的后续活动哦~", "end_picurl" => "../addons/stonefish_planting/template/images/end.jpg", "homepic" => "../addons/stonefish_planting/template/images/home.jpg", "adpic" => "../addons/stonefish_planting/template/images/banner.png", "award_times" => 1, "credit_times" => 5, "show_num" => 2, "awardnum" => 50, "xuninum" => 500, "xuninumtime" => 86400, "xuninuminitial" => 10, "xuninumending" => 100, "ticketinfo" => "请输入详细资料,兑换奖品", "isrealname" => 1, "ismobile" => 1, "isfans" => 1, "isfansname" => "真实姓名,手机号码,QQ号,邮箱,地址,性别,固定电话,证件号码,公司名称,职业,职位", "homepictime" => 0);
} else {
$reply['notawardtext'] = implode("\n", (array) iunserializer($reply['notawardtext']));
}
//print_r(uni_modules($enabledOnly = true));
//exit;
//查询是否有商户网点权限
$modules = uni_modules($enabledOnly = true);
$modules_arr = array();
$modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
if (in_array('stonefish_branch', $modules_arr)) {
$stonefish_branch = true;
}
//查询是否有商户网点权限
//查询子公众号信息
$acid_arr = uni_accounts();
$ids = array();
$ids = array_map('array_shift', $acid_arr);
//子公众账号Arr数组
$ids_num = count($ids);
//多少个子公众账号
$one = current($ids);
//查询子公众号信息
if (!$share) {
$share = array();
foreach ($ids as $acid => $idlists) {
$share[$acid] = array("acid" => $acid, "share_url" => $acid_arr[$acid]['subscribeurl'], "share_title" => "已有#参与人数#人参与本活动了,你的朋友#参与人# 还中了大奖:#奖品#,请您也来试试吧!", "share_desc" => "亲,欢迎参加种值活动,祝您好运哦!! 亲,需要绑定账号才可以参加哦", "share_picurl" => "../addons/stonefish_planting/template/images/share.png", "share_pic" => "../addons/stonefish_planting/template/images/img_share.png", "sharenumtype" => 0, "sharenum" => 0, "sharetype" => 1);
}
}
include $this->template('form');
}
示例13: get
public function get($weid, $modulename)
{
$settings = null;
$result = pdo_fetchcolumn("SELECT settings FROM " . tablename(self::$t_module) . " WHERE uniacid= :weid AND module= :name LIMIT 1", array(':name' => $modulename, ':weid' => $weid));
if (!empty($result)) {
$settings = iunserializer($result);
}
return $settings;
}
示例14: __construct
public function __construct($account)
{
$sql = 'SELECT * FROM ' . tablename('account_yixin') . ' WHERE `acid`=:acid';
$this->account = pdo_fetch($sql, array(':acid' => $account['acid']));
if (empty($this->account)) {
trigger_error('error uniAccount id, can not construct ' . __CLASS__, E_USER_WARNING);
}
$this->account['access_token'] = iunserializer($this->account['access_token']);
}
示例15: __construct
public function __construct($uniAccount)
{
$this->account = $uniAccount;
if (empty($this->account)) {
trigger_error('error uniAccount id, can not construct ' . __CLASS__, E_USER_WARNING);
}
$this->account['access_token'] = iunserializer($this->account['access_token']);
$this->apis = array('barcode' => array('post' => 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=%s', 'display' => 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=%s'));
}