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


PHP string2array函数代码示例

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


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

示例1: pc_tag

 /**
  * PC标签中调用数据
  * @param array $data 配置数据
  */
 public function pc_tag($data)
 {
     $siteid = isset($data['siteid']) && intval($data['siteid']) ? intval($data['siteid']) : get_siteid();
     $r = $this->db->select(array('pos' => $data['pos'], 'siteid' => $siteid));
     $str = '';
     if (!empty($r) && is_array($r)) {
         foreach ($r as $v) {
             if (defined('IN_ADMIN') && !defined('HTML')) {
                 $str .= '<div id="block_id_' . $v['id'] . '" class="admin_block" blockid="' . $v['id'] . '">';
             }
             if ($v['type'] == '2') {
                 extract($v, EXTR_OVERWRITE);
                 $data = string2array($data);
                 if (!defined('HTML')) {
                     ob_start();
                     include $this->template_url($id);
                     $str .= ob_get_contents();
                     ob_clean();
                 } else {
                     include $this->template_url($id);
                 }
             } else {
                 $str .= $v['data'];
             }
             if (defined('IN_ADMIN') && !defined('HTML')) {
                 $str .= '</div>';
             }
         }
     }
     return $str;
 }
开发者ID:klj123wan,项目名称:czsz,代码行数:35,代码来源:block_tag.class.php

示例2: manage

 /**
  * member list
  */
 function manage()
 {
     if (isset($_POST['dosubmit'])) {
         $member_setting = array2string($_POST['info']);
         $this->db->update(array('module' => 'member', 'setting' => $member_setting), array('module' => 'member'));
         setcache('member_setting', $_POST['info']);
         showmessage(L('operation_success'), HTTP_REFERER);
     } else {
         $show_scroll = true;
         $member_setting = $this->db->get_one(array('module' => 'member'), 'setting');
         $member_setting = string2array($member_setting['setting']);
         $email_config = getcache('common', 'commons');
         $this->sms_setting_arr = getcache('sms', 'sms');
         $siteid = get_siteid();
         if (empty($email_config['mail_user']) || empty($email_config['mail_password'])) {
             $mail_disabled = 1;
         }
         if (!empty($this->sms_setting_arr[$siteid])) {
             $this->sms_setting = $this->sms_setting_arr[$siteid];
             if ($this->sms_setting['sms_enable'] == '0') {
                 $sms_disabled = 1;
             } else {
                 if (empty($this->sms_setting['userid']) || empty($this->sms_setting['productid']) || empty($this->sms_setting['sms_key'])) {
                     $sms_disabled = 1;
                 }
             }
         } else {
             $sms_disabled = 1;
         }
         include $this->admin_tpl('member_setting');
     }
 }
开发者ID:boylzj,项目名称:omguitar,代码行数:35,代码来源:member_setting.php

示例3: editAction

 public function editAction()
 {
     $userid = (int) $this->get('userid');
     $data = $this->db->setTableName('admin')->find($userid);
     $auth = string2array($data['auth']);
     $cats = get_cache('category');
     if (empty($data)) {
         $this->show_message('该用户不存在', 2);
     }
     if ($this->post('submit')) {
         $data = $this->post('data');
         if (!empty($data['password'])) {
             if (strlen($data['password']) < 6) {
                 $this->show_message('密码最少6位数', 2, 1);
             }
             $data['password'] = md5(md5($data['password']));
         } else {
             unset($data['password']);
         }
         $auth = $this->post('auth');
         $data['auth'] = array2string($auth);
         $this->db->setTableName('admin')->update($data, 'userid=?', $userid);
         $this->cacheAction();
         $this->show_message('修改成功', 1);
     }
     include $this->admin_tpl('admin_add');
 }
开发者ID:43431655,项目名称:qizhongbao,代码行数:27,代码来源:administrator.php

示例4: fieldsFormDisplay

 public function fieldsFormDisplay($rid = 0)
 {
     //要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0
     global $_W;
     load()->func('tpl');
     $reply = pdo_fetch("SELECT * FROM " . tablename('eso_runman_reply') . " WHERE rid = :rid", array(':rid' => $rid));
     if (empty($reply)) {
         $reply['starttime'] = time();
         $reply['endtime'] = time() + 2592000;
         $reply['setting'] = array();
     } else {
         $reply['setting'] = string2array($reply['setting']);
     }
     $sql = "SELECT * FROM " . tablename('uni_account');
     $uniaccounts = pdo_fetchall($sql);
     $accounts = array();
     if (!empty($uniaccounts)) {
         foreach ($uniaccounts as $uniaccount) {
             $accountlist = uni_accounts($uniaccount['uniacid']);
             if (!empty($accountlist)) {
                 foreach ($accountlist as $account) {
                     if (!empty($account['key']) && !empty($account['secret']) && in_array($account['level'], array(3, 4))) {
                         $accounts[$account['acid']] = $account['name'];
                     }
                 }
             }
         }
     }
     include $this->template('form');
 }
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:30,代码来源:module.php

示例5: get

	public function get() {
		$id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : exit();
		if ($data = $this->db->get_one(array('id'=>$id))) {
			if (!$str = tpl_cache('dbsource_'.$id,$data['cache'])) {
				if ($data['type'] == 1) { //自定义SQL调用
					$get_db = pc_base::load_model("get_model");
					$sql = $data['data'].(!empty($data['num']) ? " LIMIT $data[num]" : '');
					$r= $get_db->query($sql);
					while(($s = $get_db->fetch_next()) != false) {
						$str[] = $s;
					}
				} else {
					$filepath = PC_PATH.'modules'.DIRECTORY_SEPARATOR.$data['module'].DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.$data['module'].'_tag.class.php';
					if (file_exists($filepath)) {
						$pc_tag = pc_base::load_app_class($data['module'].'_tag', $data['module']); 
						if (!method_exists($pc_tag, $data['action'])) {
							exit();
						}
						$sql = string2array($data['data']);
						$sql['action'] = $data['action'];
						$sql['limit'] = $data['num'];
						unset($data['num']);
						$str  = $pc_tag->$data['action']($sql);
						
					} else {
						exit();
					}
				}
				if ($data['cache']) setcache('dbsource_'.$id, $str, 'tpl_data');
			}
			echo $this->_format($data['id'], $str, $data['dis_type']);
		}
	}
开发者ID:panhongsheng,项目名称:zl_cms,代码行数:33,代码来源:call.php

示例6: edit

 public function edit()
 {
     $pos = strip_tags($_REQUEST['pos']);
     $name = MODULE_NAME;
     $model = M($name);
     $pk = ucfirst($model->getPk());
     $id = $_REQUEST[$model->getPk()];
     if (empty($id)) {
         $this->error(L('do_empty'));
     }
     if ($pos) {
         $map['pos'] = array('eq', $pos);
         if (APP_LANG) {
             $map['lang'] = array('eq', LANG_ID);
         }
         $vo = $model->where($map)->find();
     } else {
         $do = 'getBy' . $pk;
         $vo = $model->{$do}($id);
     }
     if ($vo['setup']) {
         $vo['setup'] = string2array($vo['setup']);
     }
     $this->assign('vo', $vo);
     $this->display();
 }
开发者ID:JavaAFei,项目名称:yun001,代码行数:26,代码来源:BlockAction.class.php

示例7: set

 public function set($catid, $data)
 {
     unset($data['catid']);
     $data['site'] = $this->getSiteId();
     if ($catid) {
         unset($data['typeid'], $data['modelid']);
         if ($data['synpost']) {
             //同步子栏目
             $childs = $this->child($catid);
             $childs = explode(',', $childs);
             if (count($childs) > 2) {
                 foreach ($childs as $id) {
                     if (empty($id) || $id == $catid) {
                         continue;
                     }
                     $cdata = $this->find($id);
                     $cset = string2array($cdata['setting']);
                     $cset['memberpost'] = $data['setting']['memberpost'];
                     $cset['modelpost'] = $data['setting']['modelpost'];
                     $cset['adminpost'] = $data['setting']['adminpost'];
                     $cset['rolepost'] = $data['setting']['rolepost'];
                     $cset['grouppost'] = $data['setting']['grouppost'];
                     $cset['guestpost'] = $data['setting']['guestpost'];
                     $cset['verifypost'] = $data['setting']['verifypost'];
                     $cset['verifyrole'] = $data['setting']['verifyrole'];
                     $this->update(array('setting' => array2string($cset)), 'catid=' . $id);
                 }
             }
         }
         unset($data['synpost']);
         $data['setting'] = array2string($data['setting']);
         $this->update($data, 'catid=' . $catid);
         $this->repair();
         return $catid;
     } else {
         //继承父栏目权限配置
         if (!empty($data['parentid']) && empty($data['child'])) {
             $pdata = $this->find($data['parentid']);
             $pset = string2array($pdata['setting']);
             $data['setting']['memberpost'] = $data['setting']['memberpost'] ? $data['setting']['memberpost'] : ($pset['memberpost'] ? $pset['memberpost'] : null);
             $data['setting']['modelpost'] = $data['setting']['modelpost'] ? $data['setting']['modelpost'] : ($pset['modelpost'] ? $pset['modelpost'] : null);
             $data['setting']['adminpost'] = $data['setting']['adminpost'] ? $data['setting']['adminpost'] : ($pset['adminpost'] ? $pset['adminpost'] : null);
             $data['setting']['rolepost'] = $data['setting']['rolepost'] ? $data['setting']['rolepost'] : ($pset['rolepost'] ? $pset['rolepost'] : null);
             $data['setting']['grouppost'] = $data['setting']['grouppost'] ? $data['setting']['grouppost'] : ($pset['grouppost'] ? $pset['grouppost'] : null);
             $data['setting']['guestpost'] = $data['setting']['guestpost'] ? $data['setting']['guestpost'] : ($pset['guestpost'] ? $pset['guestpost'] : null);
             $data['setting']['verifypost'] = $data['setting']['verifypost'] ? $data['setting']['verifypost'] : ($pset['verifypost'] ? $pset['verifypost'] : null);
             $data['setting']['verifyrole'] = $data['setting']['verifyrole'] ? $data['setting']['verifyrole'] : ($pset['verifyrole'] ? $pset['verifyrole'] : null);
             unset($pdata, $pset);
         }
         unset($data['synpost']);
         $data['setting'] = array2string($data['setting']);
         $data['child'] = 0;
         $data['arrchildid'] = '';
         $data['arrparentid'] = '';
         $this->insert($data);
     }
     $catid = $this->get_insert_id();
     $this->repair();
     return empty($catid) ? lang('failure') : $catid;
 }
开发者ID:kennyhonghui,项目名称:zhuoxi,代码行数:60,代码来源:CategoryModel.php

示例8: _initialize

 public function _initialize()
 {
     parent::_initialize();
     $this->assign('jumpUrl', U('User/Login/index'));
     if (empty($this->Role[$this->_groupid]['allowpost'])) {
         $this->error(L('nologin'));
     }
     $this->assign('bcid', 0);
     $this->moduleid = intval($_REQUEST['moduleid']);
     if (!in_array($this->_groupid, explode(',', $this->module[$this->moduleid]['postgroup']))) {
         $this->error(L('add_no_postgroup'));
     }
     if ($this->moduleid) {
         $this->assign('moduleid', $this->moduleid);
         $module = $this->module[$this->moduleid]['name'];
         $this->dao = D($module);
         $fields = F($this->moduleid . '_Field');
         foreach ($fields as $key => $res) {
             if ($res['unpostgroup']) {
                 $res['unpostgroup'] = explode(',', $res['unpostgroup']);
             }
             if (!in_array($this->_groupid, $res['unpostgroup']) && $res['status']) {
                 $res['setup'] = string2array($res['setup']);
                 $this->fields[$key] = $res;
             }
         }
         unset($fields);
         unset($res);
         $this->assign('fields', $this->fields);
     }
 }
开发者ID:anywn3773,项目名称:gzsrex,代码行数:31,代码来源:PostAction.class.php

示例9: edit

 public function edit()
 {
     $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : $this->error(L('illegal_parameters'));
     if ($site = $this->db->where(array('id' => $siteid))->find()) {
         if (IS_POST) {
             $this->checkToken();
             $data = $_POST['info'];
             $data['setting'] = array2string($_POST['setting']);
             if ($this->db->where(array('id' => $siteid))->save($data) !== false) {
                 $this->db->set_cache();
                 $this->success(L('setting_succ'));
             } else {
                 $this->error(L('operation_failure'));
             }
         } else {
             $template_list = template_list();
             $setting = string2array($site['setting']);
             $setting['watermark_img'] = str_replace('statics/images/water/', '', $setting['watermark_img']);
             $this->assign('template_list', $template_list);
             $this->assign('setting', $setting);
             $this->assign('data', $site);
             $this->display();
         }
     } else {
         $this->error(L('notfound'));
     }
 }
开发者ID:lxp521125,项目名称:TP-Admin,代码行数:27,代码来源:SiteAction.class.php

示例10: addart

function addart($catid, $title, $content)
{
    $info = array();
    $info['catid'] = $catid;
    $info['title'] = $title;
    $info['content'] = $content;
    $db_config = pc_base::load_config('database');
    pc_base::load_sys_class('mysql', '', 0);
    pc_base::load_sys_class('param', '', 0);
    $db = pc_base::load_model('content_model');
    $category = $categorys[3];
    $modelid = $category['modelid'];
    $db->set_model($modelid);
    $setting = string2array($category['setting']);
    $workflowid = $setting['workflowid'];
    $info['status'] = 99;
    $info['keywords'] = get_keywords($info['title'], 3);
    $info['description'] = str_cut(str_replace(array("\r\n", "\t", '[page]', '[/page]', '&ldquo;', '&rdquo;', '&nbsp;'), '', strip_tags($info['content'])), 200);
    $info['username'] = "admin";
    $info['inputtime'] = '';
    if ($db->add_content($info)) {
        return true;
    }
    return false;
}
开发者ID:baowzh,项目名称:fulianweb,代码行数:25,代码来源:xpush.php

示例11: addart

function addart($catid, $title, $content)
{
    $info = array();
    $info['catid'] = 3;
    $info['title'] = "api push";
    $info['content'] = "absolutelu api push";
    $db_config = pc_base::load_config('database');
    pc_base::load_sys_class('mysql', '', 0);
    pc_base::load_sys_class('param', '', 0);
    $db = pc_base::load_model('content_model');
    $categorys = getcache('category_content_1', 'commons');
    $category = $categorys[3];
    //var_dump($categorys);
    $modelid = $category['modelid'];
    //var_dump($modelid);
    //die;
    $db->set_model($modelid);
    $setting = string2array($category['setting']);
    $workflowid = $setting['workflowid'];
    $info['status'] = 99;
    $info['keywords'] = "";
    $info['description'] = str_cut(str_replace(array("\r\n", "\t", '[page]', '[/page]', '&ldquo;', '&rdquo;', '&nbsp;'), '', strip_tags($info['content'])), 200);
    $info['username'] = "sumuya";
    $info['inputtime'] = '';
    echo "1";
    if ($db->add_content($info)) {
        return true;
    }
    return false;
}
开发者ID:baowzh,项目名称:fulianweb,代码行数:30,代码来源:testpush.php

示例12: get

 public function get()
 {
     $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : exit;
     if ($data = $this->db->getby_id($id)) {
         if (!($str = S('dbsource_' . $id))) {
             if ($data['type'] == 1) {
                 // 自定义SQL调用
                 $get_db = Loader::model("get_model");
                 $sql = $data['data'] . (!empty($data['num']) ? " LIMIT {$data['num']}" : '');
                 $str = $get_db->query($sql);
             } else {
                 $filepath = APPS_PATH . $data['application'] . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . $data['application'] . '_tag.php';
                 if (file_exists($filepath)) {
                     $yun_tag = Loader::lib($data['application'] . ':' . $data['application'] . '_tag');
                     if (!method_exists($yun_tag, $data['do'])) {
                         exit;
                     }
                     $sql = string2array($data['data']);
                     $sql['do'] = $data['do'];
                     $sql['limit'] = $data['num'];
                     unset($data['num']);
                     $str = $yun_tag->{$data}['do']($sql);
                 } else {
                     exit;
                 }
             }
             if ($data['cache']) {
                 S('tpl_data/dbsource_' . $id, $str, $data['cache']);
             }
         }
         echo $this->_format($data['id'], $str, $data['dis_type']);
     }
 }
开发者ID:hubs,项目名称:yuncms,代码行数:33,代码来源:CallController.php

示例13: uc

 public function uc()
 {
     if (isset($_POST['dosubmit'])) {
         $data = isset($_POST['data']) ? $_POST['data'] : '';
         $data['ucuse'] = isset($_POST['ucuse']) && intval($_POST['ucuse']) ? intval($_POST['ucuse']) : 0;
         $filepath = CACHE_PATH . 'configs' . DIRECTORY_SEPARATOR . 'system.php';
         $config = (include $filepath);
         $uc_config = '<?php ' . "\ndefine('UC_CONNECT', 'mysql');\n";
         foreach ($data as $k => $v) {
             $old[] = "'{$k}'=>'" . (isset($config[$k]) ? $config[$k] : $v) . "',";
             $new[] = "'{$k}'=>'{$v}',";
             $uc_config .= "define('" . strtoupper($k) . "', '{$v}');\n";
         }
         $html = file_get_contents($filepath);
         $html = str_replace($old, $new, $html);
         $uc_config_filepath = CACHE_PATH . 'configs' . DIRECTORY_SEPARATOR . 'uc_config.php';
         @file_put_contents($uc_config_filepath, $uc_config);
         @file_put_contents($filepath, $html);
         $this->db->insert(array('name' => 'ucenter', 'data' => array2string($data)), 1, 1);
         showmessage(L('operation_success'), HTTP_REFERER);
     }
     $data = array();
     $r = $this->db->get_one(array('name' => 'ucenter'));
     if ($r) {
         $data = string2array($r['data']);
     }
     include $this->admin_tpl('system_uc');
 }
开发者ID:jiangwuzhang,项目名称:phpcms,代码行数:28,代码来源:system.php

示例14: get_setting

 /**
  * 获取应用配置
  * @param string $application
  * @return mixed|boolean
  */
 public function get_setting($application)
 {
     $result = $this->where(array('application' => $application))->find();
     if (!empty($result['setting'])) {
         return string2array($result['setting']);
     }
     return false;
 }
开发者ID:hubs,项目名称:yuncms,代码行数:13,代码来源:application_model.php

示例15: __construct

 /**
  * 构造函数
  */
 public function __construct()
 {
     parent::__construct();
     $file = FCPATH . 'config/weixin.php';
     $this->wx = is_file($file) ? string2array(file_get_contents($file)) : array();
     define("TOKEN", $this->wx['token']);
     define('WECHAT_THEME', SITE_PATH . basename(VIEW_DIR) . '/weixin/');
     $this->cache->cache_dir = APP_ROOT . 'cache/weixin/';
 }
开发者ID:rainbow88,项目名称:hummel,代码行数:12,代码来源:Wx.php


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