本文整理汇总了PHP中dr_string2array函数的典型用法代码示例。如果您正苦于以下问题:PHP dr_string2array函数的具体用法?PHP dr_string2array怎么用?PHP dr_string2array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dr_string2array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* 修改
*/
public function edit()
{
$id = (int) $this->input->get('id');
$data = $this->db->where('id', $id)->limit(1)->get($this->db->dbprefix('space_model'))->row_array();
if (!$data) {
$this->admin_msg(lang('019'));
}
if (IS_POST) {
$data = $this->input->post('data', TRUE);
$this->space_model_model->edit($id, $data);
/* 更新相关缓存 */
$this->space_model_model->cache();
$this->load->model('menu_model');
$this->menu_model->cache();
$this->load->model('member_model');
$this->member_model->cache();
/* 更新相关缓存 */
$this->system_log('修改会员空间模型【#' . $data['table'] . '】');
// 记录日志
$this->admin_msg(lang('000'), dr_url('member/model/index'), 1);
}
$data['setting'] = dr_string2array($data['setting']);
$this->template->assign(array('data' => $data, 'result' => $result));
$this->template->display('model_add.html');
}
示例2: index
/**
* 首页
*/
public function index()
{
$uid = (int) $this->input->get('uid');
if ($uid) {
$this->_space($uid);
// 带会员uid参数时进入会员空间界面
} else {
// 登录验证
$url = MEMBER_URL . SELF . '?c=login&m=index&backurl=' . urlencode(dr_now_url());
if (!$this->uid) {
$this->member_msg(lang('m-039') . $this->member_model->logout(), $url);
}
/*
$total = array();
// 会员模块统计
$module = $this->get_module(SITE_ID);
if ($module) {
$db = $this->site[SITE_ID];
foreach ($module as $dir => $m) {
if (!$this->_module_post_catid($m)) {
continue;
}
$total['name'][] = '"'.$m['name'].'"';
$total['total'][] = $db->where('uid', $this->uid)->count_all_results(SITE_ID.'_'.$dir.'_index');
}
$total['name'] = @implode(',', $total['name']);
$total['total'] = @implode(',', $total['total']);
}
*/
// 消息提醒
$notice = array();
$new_notice = $this->db->where('uid', $this->uid)->count_all_results('member_new_notice');
if ($new_notice) {
// 统计未读短消息
if ($total = $this->db->where('uid', $this->uid)->where('isnew', 1)->count_all_results('pm_members')) {
$notice[] = array('name' => '短消息', 'url' => dr_member_url('pm/index'), 'total' => $total);
}
// 统计未读系统提醒
if ($total = $this->db->where('uid', $this->uid)->where('type', 1)->where('isnew', 1)->count_all_results('member_notice_' . (int) $this->member['tableid'])) {
$notice[] = array('name' => '系统提醒', 'url' => dr_member_url('notice/index'), 'total' => $total);
}
// 统计未读会员提醒
if ($total = $this->db->where('uid', $this->uid)->where('type', 2)->where('isnew', 1)->count_all_results('member_notice_' . (int) $this->member['tableid'])) {
$notice[] = array('name' => '会员互动', 'url' => dr_member_url('notice/member'), 'total' => $total);
}
// 统计未读模块提醒
if ($total = $this->db->where('uid', $this->uid)->where('type', 3)->where('isnew', 1)->count_all_results('member_notice_' . (int) $this->member['tableid'])) {
$notice[] = array('name' => '模块提醒', 'url' => dr_member_url('notice/module'), 'total' => $total);
}
// 统计未读应用提醒
if ($total = $this->db->where('uid', $this->uid)->where('type', 4)->where('isnew', 1)->count_all_results('member_notice_' . (int) $this->member['tableid'])) {
$notice[] = array('name' => '应用提醒', 'url' => dr_member_url('notice/app'), 'total' => $total);
}
}
$this->template->assign(array('notice' => $notice, 'loginlog' => array_reverse(dr_string2array($this->member['loginlog'])), 'meta_name' => lang('m-012'), 'invite_url' => MEMBER_URL . 'index.php?c=register&uid=' . $this->uid . '&invite=' . $this->member['username'], 'new_notice' => $new_notice));
$this->template->display(IS_AJAX ? 'main.html' : 'index.html');
}
}
示例3: get
/**
* 数据
*
* @param int $id
* @return array
*/
public function get($id)
{
$data = $this->db->where('id', (int) $id)->where('relatedid', $this->relatedid)->where('relatedname', $this->relatedname)->limit(1)->get('field')->row_array();
if (!$data) {
return NULL;
}
$data['setting'] = dr_string2array($data['setting']);
return $data;
}
示例4: get
/**
* 搜索缓存数据
*
* @param intval $id
* @param intval $page
* @return array
*/
public function get($id, $page = 1)
{
$data = $this->link->where('id', $id)->limit(1)->get($this->tablename)->row_array();
if (!$data) {
return array();
}
$data['params'] = dr_string2array($data['params']);
return $data;
}
示例5: limit_page
/**
* 数据显示
*
* @param intval $uid uid
* @param intval $page 页数
* @return array
*/
public function limit_page($uid, $page)
{
$members = $touidarr = $tousernamearr = array();
$data = $this->db->query("SELECT * FROM " . $this->db->dbprefix('pm_members') . " m LEFT JOIN " . $this->db->dbprefix('pm_lists') . " t ON t.plid=m.plid WHERE m.uid={$uid} ORDER BY m.lastdateline DESC LIMIT " . $this->pagesize * ($page - 1) . ", " . $this->pagesize)->result_array();
foreach ($data as $member) {
if ($member['pmtype'] == 1) {
$users = explode('_', $member['min_max']);
$member['touid'] = $users[0] == $uid ? $users[1] : $users[0];
} else {
$member['touid'] = 0;
}
$touidarr[$member['touid']] = $member['touid'];
$members[] = $member;
}
$this->db->query("DELETE FROM " . $this->db->dbprefix('newpm') . " WHERE uid={$uid}");
$array = array();
if ($members) {
$today = SYS_TIME - SYS_TIME % 86400;
foreach ($members as $key => $data) {
$daterange = 5;
$data['founddateline'] = $data['dateline'];
$data['dateline'] = $data['lastdateline'];
$data['pmid'] = $data['plid'];
$lastmessage = dr_string2array($data['lastmessage']);
if ($lastmessage['firstauthorid']) {
$data['firstauthorid'] = $lastmessage['firstauthorid'];
$data['firstauthor'] = $lastmessage['firstauthor'];
$data['firstsummary'] = $lastmessage['firstsummary'];
}
if ($lastmessage['lastauthorid']) {
$data['lastauthorid'] = $lastmessage['lastauthorid'];
$data['lastauthor'] = $lastmessage['lastauthor'];
$data['lastsummary'] = $lastmessage['lastsummary'];
}
$data['msgfromid'] = $lastmessage['lastauthorid'];
$data['msgfrom'] = $lastmessage['lastauthor'];
$data['message'] = $lastmessage['lastsummary'];
$data['new'] = $data['isnew'];
$data['msgtoid'] = $data['touid'];
if ($data['lastdateline'] >= $today) {
$daterange = 1;
} elseif ($data['lastdateline'] >= $today - 86400) {
$daterange = 2;
} elseif ($data['lastdateline'] >= $today - 172800) {
$daterange = 3;
} elseif ($data['lastdateline'] >= $today - 604800) {
$daterange = 4;
}
$data['daterange'] = $daterange;
$data['tousername'] = get_member_value($data['touid']);
unset($data['min_max']);
$array[] = $data;
}
}
return $array;
}
示例6: get
/**
* 数据
*
* @param int $id
* @return array
*/
public function get($id)
{
$_data = $this->db->limit(1)->where('id', (int) $id)->get('member_group')->row_array();
if (!$_data) {
return NULL;
}
$_data['allowfield'] = dr_string2array($_data['allowfield']);
$_data['spacefield'] = dr_string2array($_data['spacefield']);
return $_data;
}
示例7: get
/**
* 应用数据
*
* @param string $dir
* @return array
*/
public function get($dir)
{
$data = $this->db->limit(1)->where('dirname', $dir)->get('application')->row_array();
if (!$data) {
return NULL;
}
$data['module'] = dr_string2array($data['module']);
$data['setting'] = dr_string2array($data['setting']);
return $data;
}
示例8: show
/**
* 查看值
*/
public function show()
{
$id = (int) $this->input->get('id');
$data = $this->db->where('id', $id)->limit(1)->get('cron_queue')->row_array();
if (!$data) {
exit(lang('019'));
}
echo '<pre style="width:500px;max-height:400px;overflow:auto;margin-bottom:10px;">';
print_r(dr_string2array($data['value']));
echo '</pre>';
}
示例9: price
/**
* 订单计算价格
*/
public function price()
{
$data = dr_string2array($this->input->get('data'));
$score = (int) $this->input->get('score');
// 虚拟币抵消
if ($data) {
list($price, $total, $freight) = $this->order_model->get_price($data, $score);
} else {
$freight = $price = $total = 0;
}
echo $this->input->get('callback') . '(' . json_encode(array('price' => number_format($price, 2), 'total' => number_format($total, 2), 'freight' => number_format($freight, 2))) . ')';
}
示例10: config
/**
* 配置存/取
*
* @param intval $name name值
* @param array $data 修改数据
* @return array
*/
private function config($name, $data = NULL)
{
$table = SITE_ID . '_' . APP_DIR . '_config';
$config = $this->link->where('name', $name)->limit(1)->get($table)->row_array();
$config = dr_string2array($config['value']);
if ($data) {
// 修改数据
$config = $data;
$this->link->replace($table, array('name' => $name, 'value' => dr_array2string($data)));
}
return $config;
}
示例11: permission
/**
* 会员权限划分
*/
public function permission()
{
$dir = trim(str_replace('.', '', $this->input->get('dir')), '/');
$file = $this->path . $dir . '/rule.php';
if (IS_POST) {
file_put_contents($file, dr_array2string($this->input->post('data')));
echo dr_json(1, lang('000'));
exit;
}
$this->template->assign('data', is_file($file) ? dr_string2array(file_get_contents($file)) : array());
$this->template->assign('space', $dir);
$this->template->display('space_permission.html');
}
示例12: option
/**
* 字段相关属性参数
*
* @param array $value 值
* @param array $field 字段集合
* @return string
*/
public function option($option, $field = NULL)
{
$group = array();
$option['value'] = isset($option['value']) ? $option['value'] : '';
if ($field) {
foreach ($field as $t) {
if ($t['fieldtype'] == 'Group') {
$t['setting'] = dr_string2array($t['setting']);
if (preg_match_all('/\\{(.+)\\}/U', $t['setting']['option']['value'], $value)) {
foreach ($value[1] as $v) {
$group[] = $v;
}
}
}
}
$_field = array();
$_field[] = '<option value=""> -- </option>';
foreach ($field as $t) {
if ($t['fieldtype'] != 'Group' && !@in_array($t['fieldname'], $group)) {
$_field[] = '<option value="' . $t['fieldname'] . '">' . $t['name'] . '</option>';
}
}
$_field = @implode('', @array_unique($_field));
}
return '
<tr>
<th>' . lang('294') . ':</th>
<td>
<select name="xx" id="fxx">' . $_field . '</select><div class="onShow">' . lang('295') . '</div>
</td>
</tr>
<tr>
<th>' . lang('296') . ':</th>
<td>
<textarea name="data[setting][option][value]" id="fvalue" style="width:520px;height:120px;" class="text">' . $option['value'] . '</textarea>
<br><font color="gray">' . lang('297') . '</font>
</td>
</tr>
<script type="text/javascript">
$(function() {
$("#fxx").change(function(){
var value = $(this).val();
var fvalue = $("#fvalue").val();
var text = $("#fxx").find("option:selected").text();
$("#fxx option[value=\'"+value+"\']").remove();
$("#fvalue").val(fvalue+" "+text+": {"+value+"}");
});
});
</script>
';
}
示例13: get_data
/**
* 所有数据
*
* @return array
*/
public function get_data()
{
$data = array();
$_data = $this->link->order_by('displayorder ASC,id ASC')->get($this->tablename)->result_array();
if (!$_data) {
return $data;
}
foreach ($_data as $t) {
$t['setting'] = dr_string2array($t['setting']);
$t['permission'] = dr_string2array($t['permission']);
$data[$t['id']] = $t;
}
return $data;
}
示例14: get_item_data
/**
* 用于商品订单
*/
public function get_item_data($id)
{
if (!$id) {
return NULL;
}
$data1 = $this->link->where('id', $id)->where('status', 9)->where('onsale', 1)->select('id,catid,tableid,title,thumb,price,uid,author,url,quantity,freight')->limit(1)->get($this->prefix)->row_array();
if (!$data1) {
return NULL;
}
$data2 = $this->link->where('id', $id)->select('discount,format')->limit(1)->get($this->prefix . '_data_' . $data1['tableid'])->row_array();
$data1['format'] = dr_string2array($data2['format']);
$data1['discount'] = dr_string2array($data2['discount']);
return $data1;
}
示例15: edit
/**
* 修改组
*/
public function edit()
{
$id = (int) $this->input->get('id');
$data = $this->db->where('id', $id)->limit(1)->get($this->db->dbprefix('admin_role'))->row_array();
if (!$data) {
exit(lang('019'));
}
if (IS_POST) {
exit(dr_json(1, lang('014'), $this->auth_model->edit_role($data, $this->input->post('data', TRUE))));
}
$data['site'] = dr_string2array($data['site']);
$this->template->assign('data', $data);
$this->template->display('role_add.html');
}