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


PHP array_elements函数代码示例

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


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

示例1: modify

 public function modify($id, $entity, $gifts = array())
 {
     global $_W;
     $id = intval($id);
     $rec = array_elements(array('title', 'type', 'start', 'end', 'rules', 'guide', 'banner', 'share', 'limit', 'tag'), $entity);
     $rec['uniacid'] = $_W['uniacid'];
     $condition = '`uniacid`=:uniacid AND `title`=:title AND `actid`!=:id';
     $pars = array();
     $pars[':uniacid'] = $rec['uniacid'];
     $pars[':title'] = $rec['title'];
     $pars[':id'] = $id;
     $sql = 'SELECT * FROM ' . tablename('wwx_fxxt_red_activities') . " WHERE {$condition}";
     $exists = pdo_fetch($sql, $pars);
     if (!empty($exists)) {
         return error(-1, '这个活动名称已经使用, 请更换');
     }
     $ret = pdo_update('wwx_fxxt_red_activities', $rec, array('actid' => $id, 'uniacid' => $rec['uniacid']));
     if ($ret !== false) {
         $sql = 'DELETE FROM ' . tablename('wwx_fxxt_red_activity_gifts') . " WHERE `activity`='{$id}'";
         pdo_query($sql);
         foreach ($gifts as $gift) {
             $r = array_elements(array('gift', 'quantity', 'rate'), $gift);
             $r['activity'] = $id;
             pdo_insert('wwx_fxxt_red_activity_gifts', $r);
         }
     }
     return $ret !== false;
 }
开发者ID:ChainBoy,项目名称:wxfx,代码行数:28,代码来源:Activity.class.php

示例2: fieldsFormValidate

 public function fieldsFormValidate($rid = 0)
 {
     global $_GPC, $_W;
     $this->replies = @json_decode(htmlspecialchars_decode($_GPC['replies']), true);
     if (empty($this->replies)) {
         return '必须填写有效的回复内容.';
     }
     $column = array('id', 'parent_id', 'title', 'author', 'displayorder', 'thumb', 'description', 'content', 'url', 'incontent', 'createtime');
     foreach ($this->replies as $i => &$group) {
         foreach ($group as $k => &$v) {
             if (empty($v)) {
                 unset($group[$k]);
                 continue;
             }
             if (trim($v['title']) == '') {
                 return '必须填写有效的标题.';
             }
             if (trim($v['thumb']) == '') {
                 return '必须填写有效的封面链接地址.';
             }
             $v['thumb'] = str_replace($_W['attachurl'], '', $v['thumb']);
             $v['content'] = htmlspecialchars_decode($v['content']);
             $v['createtime'] = TIMESTAMP;
             $v = array_elements($column, $v);
         }
         if (empty($group)) {
             unset($i);
         }
     }
     if (empty($this->replies)) {
         return '必须填写有效的回复内容.';
     }
     return '';
 }
开发者ID:zhang19960118,项目名称:html11,代码行数:34,代码来源:module.php

示例3: buildframes

function buildframes($types = array('platform'), $modulename = '')
{
    global $_W;
    $ms = (include IA_ROOT . '/web/common/frames.inc.php');
    $ms = array_elements($types, $ms);
    if (in_array('ext', $types)) {
        load()->model('module');
        $frames = array();
        $modules = uni_modules();
        if (!empty($modules)) {
            foreach ($modules as $m) {
                if (in_array($m['name'], array('basic', 'news', 'music', 'userapi'))) {
                    continue;
                }
                $frames[$m['type']][] = $m;
            }
        }
        $types = module_types();
        if (!empty($frames)) {
            foreach ($frames as $type => $fs) {
                $items = array();
                if (!empty($fs)) {
                    foreach ($fs as $m) {
                        $items[] = array('title' => $m['title'], 'url' => url('home/welcome/ext', array('m' => $m['name'])));
                    }
                }
                $ms['ext'][] = array('title' => $types[$type]['title'], 'items' => $items);
            }
        }
    }
    if (in_array('solution', $types)) {
        load()->model('module');
        $module = module_fetch($modulename);
        $entries = module_entries($modulename, array('menu'));
        if ($_W['role'] == 'operator') {
            foreach ($entries as &$entry1) {
                foreach ($entry1 as $index2 => &$entry2) {
                    $url_arr = parse_url($entry2['url']);
                    $url_query = $url_arr['query'];
                    parse_str($url_query, $query_arr);
                    $eid = intval($query_arr['eid']);
                    $data = pdo_fetch('SELECT * FROM ' . tablename('modules_bindings') . ' WHERE eid = :eid', array(':eid' => $eid));
                    $ixes = pdo_fetchcolumn('SELECT id FROM ' . tablename('solution_acl') . ' WHERE uid = :uid AND module = :module AND do = :do AND state = :state', array('uid' => $_W['uid'], ':module' => $modulename, ':do' => $data['do'], 'state' => $data['state']));
                    if (empty($ixes)) {
                        unset($entry1[$index2]);
                    }
                }
            }
        }
        if ($entries['menu']) {
            $menus = array('title' => $module['title']);
            foreach ($entries['menu'] as $menu) {
                $menus['items'][] = array('title' => $menu['title'], 'url' => $menu['url']);
            }
            $ms['solution'][] = $menus;
        }
    }
    return $ms;
}
开发者ID:ruige123456,项目名称:dataMining,代码行数:59,代码来源:common.func.php

示例4: create

 public function create($entity)
 {
     global $_W;
     $rec = array_elements(array('activity', 'uid'), $entity);
     $rec['uniacid'] = $_W['uniacid'];
     $rec['item'] = 'key';
     $rec['status'] = 'created';
     $rec['created'] = TIMESTAMP;
     $rec['completed'] = 0;
     $ret = pdo_insert('mbrp_trades', $rec);
     if (!empty($ret)) {
         return pdo_insertid();
     } else {
         return error(-1, '数据保存失败, 请稍后重试');
     }
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:16,代码来源:Game.class.php

示例5: modify

 public function modify($id, $entity)
 {
     global $_W;
     $id = intval($id);
     $rec = array_elements(array('title', 'uuid', 'major', 'minor', 'audit_status', 'audit_comment', 'status'), $entity);
     $rec['uniacid'] = $_W['uniacid'];
     $condition = '`uniacid`=:uniacid';
     $pars = array();
     $pars[':uniacid'] = $rec['uniacid'];
     $sql = ' SELECT * FROM ' . tablename('mbsk_devices') . " WHERE {$condition}";
     pdo_fetch($sql, $pars);
     $ret = pdo_update('mbsk_devices', $rec, array('uniacid' => $rec['uniacid'], 'id' => $id));
     if ($ret !== false) {
         return true;
     }
 }
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:16,代码来源:Device.class.php

示例6: error

     } else {
         return error(-1, '数据删除失败, 请稍后重试');
     }
 }
 public function modify($uid, $entity, $isOpenid = false)
 {
     global $_W;
     $rec = array_elements(array('unionid', 'nickname', 'gender', 'state', 'city', 'country', 'avatar'), $entity);
     $rec['uniacid'] = $_W['uniacid'];
     $filter = array();
     if ($isOpenid) {
         $filter['openid'] = $uid;
     } else {
         $filter['uid'] = intval($uid);
     }
     $ret = pdo_update('mbsk_fans', $rec, $filter);
     if ($ret !== false) {
         return true;
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:18,代码来源:Fans.class.php

示例7: modify

 public function modify($id, $entity)
 {
     global $_W;
     $id = intval($id);
     $rec = array_elements(array('title', 'type', 'remark', 'tag'), $entity);
     $rec['uniacid'] = $_W['uniacid'];
     $condition = '`uniacid`=:uniacid AND `title`=:title AND `id`!=:id';
     $pars = array();
     $pars[':uniacid'] = $rec['uniacid'];
     $pars[':title'] = $rec['title'];
     $pars[':id'] = $id;
     $sql = 'SELECT * FROM ' . tablename('mbrp_gifts') . " WHERE {$condition}";
     $exists = pdo_fetch($sql, $pars);
     if (!empty($exists)) {
         return error(-1, '这个礼品名称已经使用, 请更换');
     }
     $ret = pdo_update('mbrp_gifts', $rec, array('id' => $id));
     return $ret !== false;
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:19,代码来源:Gift.class.php

示例8: createHelp

 /**
  * 增加一次助力记录
  *      如果owner, helper 已经存在, 失败
  *   id uniacid owner helper dateline
  *
  * @param $entity 助力结构 owner, helper, dateline
  * @return int|error
  */
 public function createHelp($entity)
 {
     global $_W;
     $rec = array_elements(array('owner', 'helper', 'dateline'), $entity);
     $rec['uniacid'] = $_W['uniacid'];
     $rec['activity'] = $this->activity['actid'];
     require_once MB_ROOT . '/source/Fans.class.php';
     $f = new Fans();
     $ownerExists = $f->getOne($entity['owner']);
     $helperExists = $f->getOne($entity['helper']);
     if (!empty($ownerExists) && !empty($helperExists)) {
         $pars = array();
         $pars[':uniacid'] = $_W['uniacid'];
         $pars[':activity'] = $this->activity['actid'];
         $pars[':helper'] = $rec['helper'];
         if (!empty($this->activity['tag']['limit'])) {
             $sql = 'SELECT COUNT(*) FROM ' . tablename('mbrp_helps') . ' WHERE `uniacid`=:uniacid AND `activity`=:activity AND `helper` =:helper';
             $count = pdo_fetchcolumn($sql, $pars);
             if ($this->activity['tag']['limit'] <= $count) {
                 return error(-1, "超过次数限制, 本次活动限制每人帮助好友次数不能超过 {$this->activity['tag']['limit']} 次");
             }
         }
         $pars[':owner'] = $rec['owner'];
         $sql = 'SELECT * FROM ' . tablename('mbrp_helps') . ' WHERE `uniacid`=:uniacid AND `activity`=:activity AND `owner`=:owner AND `helper` =:helper';
         $exists = pdo_fetch($sql, $pars);
         if (!empty($exists)) {
             return error(-3, '已经帮助过这位好友了');
         }
         $ret = pdo_insert('mbrp_helps', $rec);
         if (!empty($ret)) {
             return pdo_insertid();
         } else {
             return error(-2, '数据保存失败, 请稍后重试');
         }
     } else {
         return error(-1, '用户不存在');
     }
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:46,代码来源:Shared.class.php

示例9: ext_module_manifest

 $modulepath = IA_ROOT . '/source/modules/' . $id . '/';
 $manifest = ext_module_manifest($module['name']);
 if (empty($manifest)) {
     message('模块安装配置文件不存在或是格式不正确!', '', 'error');
 }
 manifest_check($id, $manifest);
 if (version_compare($module['version'], $manifest['application']['version']) != -1) {
     message('已安装的模块版本不低于要更新的版本, 操作无效.');
 }
 if (!file_exists($modulepath . 'processor.php') && !file_exists($modulepath . 'module.php') && !file_exists($modulepath . 'receiver.php') && !file_exists($modulepath . 'site.php')) {
     message('模块缺少处理文件!', '', 'error');
 }
 $module = ext_module_convert($manifest);
 unset($module['name']);
 unset($module['id']);
 $bindings = array_elements(array_keys($points), $module, false);
 foreach ($points as $p => $row) {
     unset($module[$p]);
     if (is_array($bindings[$p]) && !empty($bindings[$p])) {
         foreach ($bindings[$p] as $entry) {
             $entry['module'] = $manifest['application']['identifie'];
             $entry['entry'] = $p;
             if ($entry['title'] && $entry['do']) {
                 //保存xml里面包含的do和title,最后删除数据库中废弃的do和title
                 $delete_do[] = $entry['do'];
                 $delete_title[] = $entry['title'];
                 $sql = 'SELECT * FROM ' . tablename('modules_bindings') . ' WHERE `module`=:module AND `entry`=:entry AND `title`=:title AND `do`=:do';
                 $pars = array();
                 $pars[':module'] = $manifest['application']['identifie'];
                 $pars[':entry'] = $p;
                 $pars[':title'] = $entry['title'];
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:31,代码来源:module.ctrl.php

示例10: implode

         }
         $rids = implode($keywords, ',');
         $sql = 'SELECT `id`, `name` FROM ' . tablename('rule') . " WHERE `id` IN ({$rids})";
         $rules = pdo_fetchall($sql);
         exit(@json_encode($rules));
     }
     exit('success');
 }
 $rid = intval($_GPC['rid']);
 if (!empty($rid)) {
     $reply = reply_single($rid);
     if (empty($reply) || $reply['uniacid'] != $_W['uniacid']) {
         message('抱歉,您操作的规则不在存或是已经被删除!', url('platform/reply', array('m' => $m)), 'error');
     }
     foreach ($reply['keywords'] as &$kw) {
         $kw = array_elements(array('type', 'content'), $kw);
     }
 }
 if (checksubmit('submit')) {
     if (empty($_GPC['name'])) {
         message('必须填写回复规则名称.');
     }
     $keywords = @json_decode(htmlspecialchars_decode($_GPC['keywords']), true);
     if (empty($keywords)) {
         message('必须填写有效的触发关键字.');
     }
     $rule = array('uniacid' => $_W['uniacid'], 'name' => $_GPC['name'], 'module' => $m, 'status' => intval($_GPC['status']), 'displayorder' => intval($_GPC['displayorder_rule']));
     if (!empty($_GPC['istop'])) {
         $rule['displayorder'] = 255;
     } else {
         $rule['displayorder'] = range_limit($rule['displayorder'], 0, 254);
开发者ID:legeng,项目名称:project-2,代码行数:31,代码来源:reply.ctrl.php

示例11: message

            if (is_error($ret)) {
                message($ret['message']);
            } else {
                message('成功创建设备', $this->createWebUrl('devices'));
            }
        }
    }
    include $this->template('device-from');
}
if ($foo == 'download') {
    if ($_W['ispost']) {
        $api = new Api();
        $device = $_GPC['device_id'];
        $entity = $api->queryDevice($device);
        if (!is_error($entity)) {
            $r = array_elements(array('device_id', 'major', 'minor', 'status', 'uuid'), $entity);
            $r['title'] = $entity['comment'];
            $c = new Device();
            $ret = $c->create($r);
            if (is_error($ret)) {
                message($ret['message']);
            } else {
                message('成功同步设备', $this->createWebUrl('devices'));
            }
        } else {
            exit('设备无效或未激活');
        }
    }
    include $this->template('device-download');
}
if ($foo == 'modify') {
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:31,代码来源:devices.inc.php

示例12: foreach

 foreach ($types as $k => $v) {
     $mset[$k] = array('title' => $v, 'menus' => array());
 }
 $ms = array();
 if (!empty($_W['account']['modules'])) {
     $bindings = pdo_fetchall('SELECT * FROM ' . tablename('modules_bindings') . " ORDER BY eid ASC");
     foreach ($_W['account']['modules'] as $m) {
         $row = array('name' => strtolower($m['name']));
         $mg = $_W['modules'][$row['name']];
         if (in_array($row['name'], array('basic', 'news', 'music', 'userapi'))) {
             continue;
         }
         if (!empty($bindings)) {
             foreach ($bindings as $entry) {
                 if (strtolower($entry['module']) == $row['name']) {
                     $m[$entry['entry']][] = array_elements(array('eid', 'call', 'title', 'do', 'direct', 'state'), $entry);
                 }
             }
         }
         $row['title'] = $mg['title'];
         $row['type'] = $mg['type'];
         $row['type'] = in_array($row['type'], array_keys($types)) ? $row['type'] : 'other';
         if (!empty($m['cover']) && is_array($m['cover'])) {
             foreach ($m['cover'] as $opt) {
                 if (!empty($opt['call'])) {
                     $site = WeUtility::createModuleSite($row['name']);
                     if (method_exists($site, $opt['call'])) {
                         $ret = $site->{$opt}['call']();
                         if (is_array($ret)) {
                             foreach ($ret as $et) {
                                 $row['items'][] = array($et['title'], $et['url']);
开发者ID:yunsite,项目名称:my-we7,代码行数:31,代码来源:frame.ctrl.php

示例13: settingsDisplay

 public function settingsDisplay($settings)
 {
     global $_GPC, $_W;
     load()->func('tpl');
     $theone = pdo_fetch('SELECT * FROM ' . tablename('wwx_fxxt_rules') . " WHERE  uniacid = :uniacid", array(':uniacid' => $_W['uniacid']));
     $id = $theone['id'];
     if (checksubmit()) {
         load()->func('file');
         mkdirs('../addons/wwx_fxxt/cert');
         $r = true;
         if (!empty($_GPC['api_cert'])) {
             $ret = file_put_contents('../addons/wwx_fxxt/cert/apiclient_cert.pem.' . $_W['uniacid'], trim($_GPC['api_cert']));
             $r = $r && $ret;
         }
         if (!empty($_GPC['api_key'])) {
             $ret = file_put_contents('../addons/wwx_fxxt/cert/apiclient_key.pem.' . $_W['uniacid'], trim($_GPC['api_key']));
             $r = $r && $ret;
         }
         if (!empty($_GPC['api_ca'])) {
             $ret = file_put_contents('../addons/wwx_fxxt/cert/rootca.pem.' . $_W['uniacid'], trim($_GPC['api_ca']));
             $r = $r && $ret;
         }
         if (!$r) {
             message('证书保存失败, 请保证 /addons/wwx_fxxt/cert/ 目录可写');
         }
         $input = array_elements(array('api_appid', 'api_secret', 'api_QrCode', 'api_QrKey', 'api_ip'), $_GPC);
         $input['api_appid'] = trim($input['api_appid']);
         $input['api_secret'] = trim($input['api_secret']);
         $input['api_QrCode'] = trim($input['api_QrCode']);
         $input['api_QrKey'] = trim($input['api_QrKey']);
         $input['api_ip'] = trim($input['api_ip']);
         $clickcredit = $_GPC['clickcredit'];
         if (!is_numeric($clickcredit)) {
             message('请输入合法数字!');
         }
         if (empty($_GPC['commtime'])) {
             message('需要设置佣金申请周期');
         }
         if (empty($_GPC['rebacktime'])) {
             message('需要设置退换货期限');
         }
         if (intval($_GPC['rebacktime']) >= intval($_GPC['commtime'])) {
             message('退换货期限不能大于货到等于佣金申请周期');
         }
         $settings['shopname'] = $_GPC['shopname'];
         //商城首页标题
         $settings['footer'] = $_GPC['footer'];
         //底部版权名称
         $settings['footerurl'] = $_GPC['footerurl'];
         //底部版权链接
         $settings['agentRegister'] = $_GPC['agentRegister'];
         //用户注册登录
         $settings['Thecharts'] = $_POST['Thecharts'];
         //开启各项排行榜
         $settings['Themessage'] = $_GPC['Themessage'];
         //开启排行榜聊天系统
         $settings['ThechartsSum'] = $_GPC['ThechartsSum'];
         //排行榜数量
         $settings['indexss'] = intval($_GPC['indexss']);
         //首页限时特卖
         $settings['webjs'] = $_GPC['webjs'];
         //全局JS参数设置
         $settings['commtime'] = $_GPC['commtime'];
         //佣金申请周期
         $settings['zhifuCommission'] = $_GPC['zhifuCommission'];
         //佣金打款限额
         $settings['globalPattern'] = $_GPC['globalPattern'];
         //分佣方式
         $settings['globalCommissionLevel'] = $_GPC['globalCommissionLevel'];
         //分销等级
         $settings['globalCommission'] = $_GPC['globalCommission'];
         //1级整站佣金
         $settings['globalCommission2'] = $_GPC['globalCommission2'];
         //2级整站佣金
         $settings['globalCommission3'] = $_GPC['globalCommission3'];
         //3级整站佣金
         $settings['agentupgrade'] = $_GPC['agentupgrade'];
         //代理自动升级
         $settings['dimensionalcode'] = $_GPC['dimensionalcode'];
         //二维码权限
         $settings['fansupgrade'] = $_GPC['fansupgrade'];
         //会员自动升级
         $settings['description'] = $_GPC['description'];
         //转发话术
         $settings['ydyy'] = $_GPC['ydyy'];
         //未关注引导页面
         $settings['huodaoCommission'] = $_GPC['huodaoCommission'];
         //货到付款保证金
         $settings['autofinish'] = $_GPC['autofinish'];
         //订单自动确认收货天数
         $settings['rebacktime'] = $_GPC['rebacktime'];
         //退换货期限天数
         $settings['ordertime'] = $_GPC['ordertime'];
         //自动取消订单时间,单位分钟
         $settings['api'] = $input;
         //微信现金打款设置
         //自动取消订单时间,单位分钟
         if (intval($_GPC['ordertime']) >= 30) {
             $settings['ordertime'] = $_GPC['ordertime'];
         } else {
//.........这里部分代码省略.........
开发者ID:ChainBoy,项目名称:wxfx,代码行数:101,代码来源:module.php

示例14: uni_setting

function uni_setting($uniacid = 0, $fields = '*')
{
    global $_W;
    $uniacid = empty($uniacid) ? $_W['uniacid'] : $uniacid;
    static $unisettings;
    if (empty($unisettings)) {
        $unisettings = array();
    }
    if (empty($unisettings[$uniacid])) {
        $unisetting = pdo_fetch("SELECT * FROM " . tablename('uni_settings') . " WHERE uniacid = :uniacid", array(':uniacid' => $uniacid));
        if (!empty($unisetting)) {
            $serialize = array('site_info', 'menuset', 'stat', 'oauth', 'passport', 'uc', 'notify', 'creditnames', 'default_message', 'creditbehaviors', 'shortcuts', 'quickmenu', 'payment', 'groupdata');
            foreach ($unisetting as $key => &$row) {
                if (in_array($key, $serialize)) {
                    $row = iunserializer($row);
                }
            }
        }
        $unisettings[$uniacid] = $unisetting;
    }
    if (is_array($fields)) {
        return array_elements($fields, $unisettings[$uniacid]);
    }
    return $unisettings[$uniacid];
}
开发者ID:6662680,项目名称:qday_wx,代码行数:25,代码来源:account.mod.php

示例15: defined

<?php

/**
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('platform_menu');
$current['designer'] = ' class="current"';
$acc = account_fetch($_W['acid']);
$acc = array_elements(array('name', 'acid', 'level'), $acc);
$dos = array('display', 'save', 'remove', 'refresh', 'search_key');
if ($_W['isajax']) {
    if ($do == 'search_key') {
        $condition = '';
        $key_word = trim($_GPC['key_word']);
        if (!empty($key_word)) {
            $condition = " AND content LIKE '%{$key_word}%' ";
        }
        $data = pdo_fetchall('SELECT content FROM ' . tablename('rule_keyword') . " WHERE (uniacid = 0 OR uniacid = :uniacid) AND status != 0 " . $condition . ' ORDER BY uniacid DESC,displayorder DESC LIMIT 15', array(':uniacid' => $_W['uniacid']));
        $exit_da = array();
        if (!empty($data)) {
            foreach ($data as $da) {
                $exit_da[] = $da['content'];
            }
        }
        exit(json_encode($exit_da));
    }
    $post = $_GPC['__input'];
    if (!empty($post['method'])) {
        $do = $post['method'];
开发者ID:aspnmy,项目名称:weizan,代码行数:31,代码来源:menu.ctrl.php


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