本文整理匯總了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']) {
//.........這裏部分代碼省略.........