本文整理汇总了PHP中site::selects方法的典型用法代码示例。如果您正苦于以下问题:PHP site::selects方法的具体用法?PHP site::selects怎么用?PHP site::selects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类site
的用法示例。
在下文中一共展示了site::selects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: append
/**
* 添加关系
*/
public static final function append()
{
$error = array();
$online = front::online();
$get = array('s_type' => isset($_GET['s_type']) ? $_GET['s_type'] : '', 't_type' => isset($_GET['t_type']) ? $_GET['t_type'] : '', 's_id' => isset($_GET['s_id']) ? (int) $_GET['s_id'] : '0', 't_id' => isset($_GET['t_id']) ? (int) $_GET['t_id'] : '0');
$s_list = null;
if ($get['s_type'] == 'channel') {
$s_list = channel::get_channel_select(0, 0, $get['s_id'], null, null);
} elseif ($get['s_type'] == 'address') {
$s_lists = address::selects('address_id as id,name', null, array('user_id' => $online->user_id), array('ORDER BY address_id DESC'), array('id', 'column|table=address' => 'name'));
if ($s_lists) {
$s_list = make_option($s_lists, $get['s_id']);
}
} elseif ($get['s_type'] == 'book') {
$s_lists = book::selects('book_id as id,concat_ws(\',\',create_date,item_txt,remark,ccy,amount,otype) as name', null, array('user_id' => $online->user_id), array('ORDER BY create_date DESC,book_id DESC'), array('id', 'column|table=book' => 'name'));
if ($s_lists) {
$s_list = make_option($s_lists, $get['s_id']);
}
} elseif ($get['s_type'] == 'diary') {
$s_lists = diary::selects('diary_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY diary_id DESC'), array('id', 'column|table=diary' => 'name'));
if ($s_lists) {
$s_list = make_option($s_lists, $get['s_id']);
}
} elseif ($get['s_type'] == 'doc') {
$s_lists = doc::selects('doc_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY doc_id DESC'), array('id', 'column|table=doc' => 'name'));
if ($s_lists) {
$s_list = make_option($s_lists, $get['s_id']);
}
} elseif ($get['s_type'] == 'site') {
$s_lists = site::selects('site_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY site_id DESC'), array('id', 'column|table=site' => 'name'));
if ($s_lists) {
$s_list = make_option($s_lists, $get['s_id']);
}
} elseif ($get['s_type'] == 'user') {
$s_lists = user::selects('user_id as id,username as name', null, array('user_id' => $online->user_id), array('ORDER BY user_id DESC'), array('id', 'column|table=user' => 'name'));
if ($s_lists) {
$s_list = make_option($s_lists, $get['s_id']);
}
} else {
}
$t_list = null;
if ($get['t_type'] == 'channel') {
$t_list = channel::get_channel_select(0, 0, $get['t_id'], null, null);
} elseif ($get['t_type'] == 'address') {
$t_lists = address::selects('address_id as id,name', null, array('user_id' => $online->user_id), array('ORDER BY address_id DESC'), array('id', 'column|table=address' => 'name'));
if ($t_lists) {
$t_list = make_option($t_lists, $get['t_id']);
}
} elseif ($get['t_type'] == 'book') {
$t_lists = book::selects('book_id as id,concat_ws(\',\',create_date,item_txt,remark,ccy,amount,otype) as name', null, array('user_id' => $online->user_id), array('ORDER BY create_date DESC,book_id DESC'), array('id', 'column|table=book' => 'name'));
if ($t_lists) {
$t_list = make_option($t_lists, $get['t_id']);
}
} elseif ($get['t_type'] == 'diary') {
$t_lists = diary::selects('diary_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY diary_id DESC'), array('id', 'column|table=diary' => 'name'));
if ($t_lists) {
$t_list = make_option($t_lists, $get['t_id']);
}
} elseif ($get['t_type'] == 'doc') {
$t_lists = doc::selects('doc_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY doc_id DESC'), array('id', 'column|table=doc' => 'name'));
if ($t_lists) {
$t_list = make_option($t_lists, $get['t_id']);
}
} elseif ($get['t_type'] == 'site') {
$t_lists = site::selects('site_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY site_id DESC'), array('id', 'column|table=site' => 'name'));
if ($t_lists) {
$t_list = make_option($t_lists, $get['t_id']);
}
} elseif ($get['t_type'] == 'user') {
$t_lists = user::selects('user_id as id,username as name', null, array('user_id' => $online->user_id), array('ORDER BY user_id DESC'), array('id', 'column|table=user' => 'name'));
if ($t_lists) {
$t_list = make_option($t_lists, $get['t_id']);
}
} else {
}
// 表单处理
while (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') {
// 数据消毒
$post = array('s_type' => isset($_POST['s_type']) ? $_POST['s_type'] : '', 't_type' => isset($_POST['t_type']) ? $_POST['t_type'] : '', 's_id' => isset($_POST['s_id']) ? (int) $_POST['s_id'] : '0', 't_id' => isset($_POST['t_id']) ? (int) $_POST['t_id'] : '0', 'user_id' => $online->user_id);
if (!$post['s_type']) {
$error['s_type'] = '请选择源类型';
}
if (!$post['t_type']) {
$error['t_type'] = '请选择目标类型';
}
if (!$post['s_id']) {
$error['s_id'] = '请选择源内容';
}
if (!$post['t_id']) {
$error['t_id'] = '请选目标内容';
}
if (!$error['t_id']) {
if ($post['s_type'] == $post['t_type'] && $post['s_id'] == $post['t_id']) {
$error['t_id'] = '不能和自己关联';
}
}
if (!$error['t_id']) {
//.........这里部分代码省略.........