本文整理汇总了PHP中array2string函数的典型用法代码示例。如果您正苦于以下问题:PHP array2string函数的具体用法?PHP array2string怎么用?PHP array2string使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array2string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_setting
public function set_setting($application, $setting = null)
{
if (!is_null($setting)) {
return $this->where(array('application' => $application))->update(array('setting' => array2string($setting)));
}
return false;
}
示例2: save
/**
* 保存配置信息
*/
public function save()
{
$setting = array();
$setting['admin_email'] = is_email($_POST['setting']['admin_email']) ? trim($_POST['setting']['admin_email']) : showmessage(L('email_illegal'), HTTP_REFERER);
$setting['maxloginfailedtimes'] = intval($_POST['setting']['maxloginfailedtimes']);
$setting['minrefreshtime'] = intval($_POST['setting']['minrefreshtime']);
$setting['mail_type'] = intval($_POST['setting']['mail_type']);
$setting['mail_server'] = trim($_POST['setting']['mail_server']);
$setting['mail_port'] = intval($_POST['setting']['mail_port']);
$setting['category_ajax'] = intval(abs($_POST['setting']['category_ajax']));
$setting['mail_user'] = trim($_POST['setting']['mail_user']);
$setting['mail_auth'] = intval($_POST['setting']['mail_auth']);
$setting['mail_from'] = trim($_POST['setting']['mail_from']);
$setting['mail_password'] = trim($_POST['setting']['mail_password']);
$setting['errorlog_size'] = trim($_POST['setting']['errorlog_size']);
$setting = array2string($setting);
$this->db->update(array('setting' => $setting), array('module' => 'admin'));
//存入admin模块setting字段
//如果开始盛大通行证接入,判断服务器是否支持curl
$snda_error = '';
if ($_POST['setconfig']['snda_akey'] || $_POST['setconfig']['snda_skey']) {
if (function_exists('curl_init') == FALSE) {
$snda_error = L('snda_need_curl_init');
$_POST['setconfig']['snda_enable'] = 0;
}
}
set_config($_POST['setconfig']);
//保存进config文件
$this->setcache();
showmessage(L('setting_succ') . $snda_error, HTTP_REFERER);
}
示例3: add
function add()
{
if ($_POST['dosubmit']) {
$siteid = intval($_POST['siteid']) ? intval($_POST['siteid']) : showmessage(L('parameter_error'), HTTP_REFERER);
if ($this->db->get_one(array('siteid' => $siteid))) {
showmessage(L('wap_add_samesite_error'), HTTP_REFERER);
}
$sitename = trim(new_addslashes($_POST['sitename']));
$logo = trim($_POST['logo']);
$domain = trim($_POST['domain']);
$setting = array2string($_POST['setting']);
$return_id = $this->db->insert(array('siteid' => $siteid, 'sitename' => $sitename, 'logo' => $logo, 'domain' => $domain, 'setting' => $setting), '1');
$this->wap_site_cache();
showmessage(L('operation_success'), '', '', 'add');
} else {
$sitelists = array();
$current_siteid = get_siteid();
$sitelists = $this->sites->get_list();
if ($_SESSION['roleid'] == '1') {
foreach ($sitelists as $key => $v) {
$sitelist[$key] = $v['name'];
}
} else {
$sitelist[$current_siteid] = $sitelists[$current_siteid]['name'];
}
$show_header = true;
include $this->admin_tpl('m_add');
}
}
示例4: ajaxeditAction
public function ajaxeditAction()
{
$user = $this->userinfo;
$userid = $user['userid'];
if ($this->post('submit')) {
$usermenu = $this->post('menu');
$menu = array();
foreach ($usermenu['name'] as $id => $v) {
if ($v && $usermenu['url'][$id]) {
$menu[$id] = array('name' => $v, 'url' => $usermenu['url'][$id]);
}
}
$data = array('realname' => $this->post('realname'), 'email' => $this->post('email'), 'usermenu' => array2string($menu));
if ($this->post('password')) {
$data['password'] = md5(md5($this->post('password')) . $user['salt'] . md5($this->post('password')));
}
$this->user->update($data, 'userid=' . $userid);
$this->adminMsg(lang('success'), url('admin/user/ajaxedit/'), 3, 1, 1);
}
if (empty($user)) {
$this->adminMsg(lang('a-use-3'));
}
$this->view->assign(array('data' => $user, 'menu' => string2array($user['usermenu'])));
$this->view->display('admin/user_edit');
}
示例5: edit
/**
* 广告修改
*/
public function edit()
{
$_GET['id'] = intval($_GET['id']);
if (!$_GET['id']) {
showmessage(L('illegal_action'), HTTP_REFERER);
}
if (isset($_POST['dosubmit'])) {
$poster = $this->check($_POST['poster']);
$setting = $this->check_setting($_POST['setting'], $poster['type']);
$poster['setting'] = array2string($setting);
$this->db->update($poster, array('id' => $_GET['id'], 'siteid' => $this->get_siteid()));
$this->create_js(intval($_GET['spaceid']));
foreach ($setting as $im) {
$imgs[] = $im['imageurl'];
}
if (pc_base::load_config('system', 'attachment_stat')) {
$this->attachment_db = pc_base::load_model('attachment_model');
$this->attachment_db->api_update($imgs, 'poster-' . $_GET['id'], 1);
}
showmessage(L('edit_ads_success'), 'index.php?m=poster&c=poster&a=init&spaceid=' . $_GET['spaceid']);
} else {
$info = $this->db->get_one(array('id' => $_GET['id'], 'siteid' => $this->get_siteid()));
$sinfo = $this->s_db->get_one(array('spaceid' => $info['spaceid'], 'siteid' => $this->get_siteid()), 'name, type');
$setting = $this->get_setting($sinfo['type']);
$TYPES = get_types();
$info['setting'] = string2array($info['setting']);
$default = count($setting) > 0 ? L('please_select') . ' ' : '';
$big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=poster&c=space&a=add\', title:\'' . L('add_space') . '\', width:\'540\', height:\'320\'}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_space'));
pc_base::load_sys_class('form', '', 0);
include $this->admin_tpl('poster_edit');
}
}
示例6: 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');
}
}
示例7: edit
/**
* 广告修改
*/
public function edit() {
$_GET['id'] = intval($_GET['id']);
if (!$_GET['id']) showmessage(L('illegal_action'), HTTP_REFERER);
if (isset($_POST['dosubmit'])) {
$poster = $this->check($_POST['poster']);
$setting = $this->check_setting($_POST['setting'], $poster['type']);
$poster['setting'] = array2string($setting);
$this->db->update($poster, array('id'=>$_GET['id'], 'siteid'=>$this->get_siteid()));
$this->create_js(intval($_GET['spaceid']));
foreach ($setting as $im) {
$imgs[] = $im['imageurl'];
}
if(pc_base::load_config('system','attachment_stat')) {
$this->attachment_db = pc_base::load_model('attachment_model');
$this->attachment_db->api_update($imgs, 'poster-'.$_GET['id'], 1);
}
showmessage(L('operation_success'), HTTP_REFERER, '', 'edit');
} else {
$info = $this->db->get_one(array('id'=>$_GET['id'], 'siteid'=>$this->get_siteid()));
$sinfo = $this->s_db->get_one(array('spaceid' => $info['spaceid'], 'siteid'=>$this->get_siteid()), 'name, type');
$setting = $this->get_setting($sinfo['type']);
$TYPES = get_types();
$info['setting'] = string2array($info['setting']);
$default = count($setting)>0 ? L('please_select').' ' : '';
pc_base::load_sys_class('form', '', 0);
include $this->admin_tpl('poster_edit');
}
}
示例8: edit
/**
* 编辑表单向导
*/
public function edit()
{
if (!isset($_GET['formid']) || empty($_GET['formid'])) {
showmessage(L('illegal_operation'), HTTP_REFERER);
}
$formid = intval($_GET['formid']);
if (isset($_POST['dosubmit'])) {
if ($_POST['setting']['starttime']) {
$_POST['setting']['starttime'] = strtotime($_POST['setting']['starttime']);
}
if ($_POST['setting']['endtime']) {
$_POST['setting']['endtime'] = strtotime($_POST['setting']['endtime']);
}
$_POST['info'] = $this->check_info($_POST['info'], $formid);
$_POST['info']['setting'] = array2string($_POST['setting']);
$_POST['info']['js_template'] = $_POST['info']['show_js_template'];
unset($_POST['info']['show_js_template']);
$this->db->where(array('modelid' => $formid))->update($_POST['info']);
showmessage(L('update_success'), U('formguide/formguide/edit', array('formid' => $formid)), '', 'edit');
} else {
$template_list = template_list(0);
foreach ($template_list as $k => $v) {
$template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
unset($template_list[$k]);
}
$data = $this->db->getby_modelid($formid);
$data['setting'] = string2array($data['setting']);
$show_header = $show_validator = $show_scroll = 1;
include $this->view('formguide_edit');
}
}
示例9: edit
public function edit()
{
if (isset($_POST['dosubmit'])) {
$infos = $this->method->get_payment($_POST['pay_code']);
$config = $infos['config'];
foreach ($_POST['config_name'] as $key => $value) {
$config[$value]['value'] = trim($_POST['config_value'][$key]);
}
$info['config'] = array2string($config);
$info['name'] = trim($_POST['name']);
$info['pay_name'] = trim($_POST['pay_name']);
$info['pay_desc'] = trim($_POST['description']);
$info['pay_id'] = $_POST['pay_id'];
$info['pay_code'] = trim($_POST['pay_code']);
$info['pay_order'] = intval($_POST['pay_order']);
$info['pay_method'] = intval($_POST['pay_method']);
$info['pay_fee'] = intval($_POST['pay_method']) == 0 ? intval($_POST['pay_rate']) : intval($_POST['pay_fix']);
$info['is_cod'] = trim($_POST['is_cod']);
$info['is_online'] = trim($_POST['is_online']);
$info['enabled'] = '1';
$info['author'] = $infos['author'];
$info['website'] = $infos['website'];
$info['version'] = $infos['version'];
$infos = $this->db->update($info, array('pay_id' => $info['pay_id']));
showmessage(L('edit') . L('succ'), '', '', 'edit');
} else {
$pay_id = intval($_GET['id']);
$infos = $this->db->get_one(array('pay_id' => $pay_id));
extract($infos);
$config = string2array($config);
$show_header = true;
$show_validator = true;
include $this->admin_tpl('payment_detail');
}
}
示例10: set
/**
* 添加、修改内容数据
*/
public function set($id, $data)
{
//数组转化为字符
foreach ($data as $i => $t) {
if (is_array($t)) {
$data[$i] = array2string($t);
}
}
if ($id) {
//修改
unset($data['id']);
$this->update($data, 'id=' . $id);
} else {
//添加
$id = $this->get_form_id();
//生成唯一id
$data['id'] = $id;
if (empty($id)) {
return false;
}
$this->insert($data);
// 回调函数
$table = str_replace($this->prefix, '', $this->table_name);
$function = 'callback_' . $table;
$file = MODEL_DIR . 'callback/' . $table . '.php';
if (is_file($file)) {
include_once $file;
if (function_exists($function)) {
$function($data);
}
}
}
return $id;
}
示例11: editAction
/**
* 资料修改
*/
public function editAction()
{
$modelid = $this->memberinfo[modelid];
$fields = $this->membermodel[$modelid]['fields'];
if ($this->isPostForm()) {
$data = $this->input->post('data', TRUE);
$this->checkFields($fields, $data, 2);
$this->member->update(array('nickname' => $data['nickname']), 'id=' . $this->memberinfo['id']);
$memberdata = $this->memberdata->find($this->memberinfo['id']);
foreach ($data as $i => $t) {
if (is_array($t)) {
$data[$i] = array2string($t);
}
}
if ($memberdata) {
//修改附表内容
$this->memberdata->update($data, 'id=' . $this->memberinfo['id']);
} else {
$data['id'] = $this->memberinfo['id'];
$this->memberdata->insert($data);
}
//增加会员统计表
$count = $this->model('member_count');
$data = $count->find($this->memberinfo['id']);
if (!$data) {
$count->insert(array('id' => $this->memberinfo['id']));
}
$this->memberMsg(lang('success'), url('member/info/edit'), 1);
}
//自定义字段
$data_fields = $this->getFields($fields, $this->memberinfo);
$this->view->assign(array('data_fields' => $data_fields, 'meta_title' => lang('m-inf-0') . '-' . lang('member') . '-' . $this->site['SITE_NAME']));
$this->view->display('member/edit');
}
示例12: 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;
}
示例13: edit
/**
* 广告修改
*/
public function edit()
{
$_GET['id'] = intval($_GET['id']);
if (!$_GET['id']) {
showmessage(L('illegal_action'), HTTP_REFERER);
}
if (isset($_POST['dosubmit'])) {
$poster = $this->check($_POST['poster']);
$setting = $this->check_setting($_POST['setting'], $poster['type']);
$poster['setting'] = array2string($setting);
$this->db->where(array('id' => $_GET['id']))->update($poster);
$this->create_js(intval($_GET['spaceid']));
foreach ($setting as $im) {
$imgs[] = $im['imageurl'];
}
if (C('attachment', 'stat')) {
$this->attachment_db = Loader::model('attachment_model');
$this->attachment_db->api_update($imgs, 'poster-' . $_GET['id'], 1);
}
showmessage(L('operation_success'), HTTP_REFERER, '', 'edit');
} else {
$info = $this->db->where(array('id' => $_GET['id']))->find();
$sinfo = $this->s_db->field('name, type')->where(array('spaceid' => $info['spaceid']))->find();
$setting = $this->get_setting($sinfo['type']);
$TYPES = get_types();
$info['setting'] = string2array($info['setting']);
$default = count($setting) > 0 ? L('please_select') . ' ' : '';
include $this->view('poster_edit');
}
}
示例14: 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'));
}
}
示例15: 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');
}