本文整理汇总了PHP中get_count函数的典型用法代码示例。如果您正苦于以下问题:PHP get_count函数的具体用法?PHP get_count怎么用?PHP get_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_count函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: count
static function count($force = false)
{
global $db;
$count = get_count('posts');
if ($count === false || $force) {
$count = $db->get_var("select count(*) from posts");
set_count('posts', $count);
}
return $count;
}
示例2: index
function index($page = NULL)
{
check_admin();
$data = array();
$limit = 10;
$page = intval($page) > 0 ? $page : 1;
$start = ($page - 1) * $limit;
$data['froms'] = $this->form->get_forms($start, $limit);
$page_all = ceil(get_count() / $limit);
$data['pager'] = get_pager($page, $page_all, '/design');
$this->view('index', $data);
}
示例3: index
function index()
{
//$data = array();
$data['ci_top_title'] = '微件列表';
$args = func_get_args();
if (isset($args[2])) {
$search = strip_tags(trim($args[2]));
$search = urldecode($search);
} else {
$search = strip_tags(trim(v('search')));
}
$data['search'] = $search;
$type = intval(v('type'));
if ($args) {
$mid = intval($args[0]);
}
if (!isset($mid) || $mid == '') {
$mid = $type;
}
//
if ($mid == '0') {
$where = " AND `name` LIKE '%" . $search . "%' ";
//$data['name'] = '全部范围';
} elseif ($mid > '0') {
$where = " AND `mid` = '" . intval($mid) . "' AND `name` LIKE '%" . $search . "%'";
$name = lazy_get_var("SELECT `name` FROM `u2_plugs` WHERE 1 AND `id` = '" . intval($mid) . "'");
if (!$name) {
info_page('错误的组件ID');
}
} else {
info_page('错误的组件ID');
}
$data['mid'] = $mid;
$data['plugs_name'] = lazy_get_data("SELECT * FROM `u2_plugs`");
$data['page'] = $page = !isset($args[1]) || intval($args[1]) < 1 ? 1 : intval($args[1]);
$limit = 5;
$start = ($page - 1) * $limit;
$item = lazy_get_data("SELECT sql_calc_found_rows * FROM `u2_plugs_widget` WHERE 1 {$where} ORDER BY `id` DESC LIMIT {$start},{$limit}");
$all = get_count();
$data['item'] = $item;
//$type = urlencode( $type );
$base = '/plugs/index/' . $mid;
$page_all = ceil($all / $limit);
$text = urlencode($search);
$data['pager'] = get_pager($page, $page_all, $base, $text);
$data['is_admin'] = is_admin() ? true : false;
$domain = _sess('domain');
if ($domain != '') {
$data['domain'] = $domain;
}
$this->view('list', $data);
}
示例4: count
static function count($status = '', $force = false)
{
global $db, $globals;
$my_id = SitesMgr::my_id();
if (!$status) {
return Link::count('published', $force) + Link::count('queued', $force) + Link::count('discard', $force) + Link::count('abuse', $force) + Link::count('autodiscard', $force);
}
$count = get_count("{$my_id}.{$status}");
if ($count === false || $force) {
$count = $db->get_var("select count(*) from sub_statuses where id = {$my_id} and status = '{$status}'");
set_count("{$my_id}.{$status}", $count);
}
return $count;
}
示例5: add
function add($mas)
{
global $mysqli;
$query = $mysqli->query("Select id_group from tb_group WHERE name_doup='" . $mas[2] . "';");
$id = '';
while ($row = $query->fetch_assoc()) {
$id = $row["id_group"];
}
if ($id == '') {
$mysqli->query("insert into tb_group set name_doup='" . $mas[2] . "';");
$id = $mysqli->insert_id;
}
echo get_count($query) . ' ' . $id . '<br>';
$query = $mysqli->query("INSERT into tb_items set id_items='" . $mas[0] . "', id_cat='" . $id . "', price='" . $mas[8] . "', name='" . $mas[4] . "', disrc='" . $mas[9] . "',full_disr='" . $mas[9] . "';");
}
示例6: count
static function count($status = '', $cat = '', $force = false)
{
global $db;
if (!$status) {
return Link::count('published', $cat, $force) + Link::count('queued', $cat, $force) + Link::count('discard', $cat, $force) + Link::count('abuse', $cat, $force) + Link::count('autodiscard', $cat, $force);
}
$count = get_count("{$status}.{$cat}");
if ($count === false || $force) {
if ($cat) {
$cond = " and link_category in ({$cat}) ";
}
$count = $db->get_var("select count(*) from links where link_status = '{$status}' {$cond}");
set_count("{$status}.{$cat}", $count);
}
return $count;
}
示例7: count
static function count($status='', $cat='', $force = false) {
global $db;
if (!$status) return Link::count('published', $cat, $force) +
Link::count('queued', $cat, $force) +
Link::count('discard', $cat, $force) +
Link::count('abuse', $cat, $force) +
Link::count('autodiscard', $cat, $force);
$count = get_count("$status.$cat");
if ($count === false || $force) {
if ($cat) $cond = " and link_category in ($cat) ";
$count = $db->get_var("select count(*) from links where link_status = '$status' $cond");
set_count("$status.$cat", $count);
}
return $count;
}
示例8: count
static function count($status = '', $cat = '', $force = false)
{
global $db, $globals;
$my_id = SitesMgr::my_id();
if (!$status) {
return Link::count('published', $cat, $force) + Link::count('queued', $cat, $force) + Link::count('discard', $cat, $force) + Link::count('abuse', $cat, $force) + Link::count('autodiscard', $cat, $force);
}
$count = get_count("{$my_id}.{$status}.{$cat}");
if ($count === false || $force) {
if (!empty($cat)) {
$extra = "and category in ({$cat})";
} else {
$extra = '';
}
$count = $db->get_var("select count(*) from sub_statuses where id = {$my_id} and status = '{$status}' {$extra}");
set_count("{$my_id}.{$status}.{$cat}", $count);
}
return $count;
}
示例9: get_test_one
/**
* 获取一道测试题目和题目选项
*
* @param integer $offset;
* return array;
*/
function get_test_one($offset)
{
$tc_id = get_tcid($offset);
$count = get_count($tc_id);
$num = get_total($tc_id);
$sql = "SELECT * FROM {$GLOBALS['dbTablePre']}test_question WHERE `tc_id`='{$tc_id}' \n\t\tLIMIT {$num},1";
echo $sql, '<br>';
$question = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
$sql = "SELECT * FROM {$GLOBALS['dbTablePre']}test_question_option WHERE `qid`='{$question['qid']}'";
//echo $sql,'<br>';
$option = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
$temp = array();
$temp['tc_id'] = $tc_id;
$temp['count'] = $count;
$temp['num'] = $num;
$temp['question'] = $question;
$temp['option'] = $option;
return $temp;
}
示例10: get_system_plugs_data
function get_system_plugs_data($para = NULL)
{
$para = unserialize($para);
$page = 1;
if (isset($para['args'])) {
$page = intval(array_shift($para['args']));
}
$page = $page < 1 ? 1 : $page;
$data['title'] = isset($para['title']) && strip_tags($para['title']) != '' ? strip_tags($para['title']) : '组件';
$limit = isset($para['limit']) && intval($para['limit']) > 0 ? intval($para['limit']) : 5;
$start = ($page - 1) * $limit;
$data['lines'] = 4;
$apps = lazy_get_data("SELECT sql_calc_found_rows * FROM `u2_plugs` WHERE `is_active` = 1 ORDER BY `has_widget` DESC LIMIT {$start},{$limit} ");
$all = get_count();
$wid = intval($GLOBALS['widget_id']);
$page_all = ceil($all / $limit);
$data['pager'] = get_widget_pager($wid, $page, $page_all);
if ($apps) {
foreach ($apps as $k => $v) {
$aids[$v['aid']] = $v['aid'];
$uids[$v['uid']] = $v['uid'];
}
if ($uids) {
$data['names'] = get_name_by_uids($uids);
}
$data['aids'] = $aids;
$data['apps'] = $apps;
}
$wids = lazy_get_data("SELECT * FROM `u2_plugs_widget`");
if ($wids) {
$data['wids'] = $wids;
}
$domain = _sess('domain');
if ($domain != '') {
$data['domain'] = $domain;
}
if (is_login()) {
$data['is_login'] = true;
}
return $data;
}
示例11: sizeof
$flow_cnt = sizeof($flow_arr);
if ($flow_cnt > 0) {
for ($c = 0; $c < $flow_cnt; $c++) {
if ($flow_arr[$c] == $login_id) {
$flow_no = $c + 1;
break;
}
}
}
$view = false;
$recognize_sign = get_first("workflow_ret", "recognize_sign", "refno=" . $row["seqno"] . " AND seqno=" . $flow_no, "");
if ($recognize_sign == "") {
if ($flow_no == 1) {
$view = true;
} else {
$before_res_cnt = get_count("workflow_ret", "refno=" . $row["seqno"] . " AND seqno=" . ($flow_no - 1));
if ($before_res_cnt > 0) {
$view = true;
}
}
}
if ($view) {
$v++;
print "<TR>";
// メモ内容
print "<TD VALIGN=TOP>";
print "・<A HREF=\"./workflow/result/?p=top&no=" . $row["seqno"] . "\">";
$subject = mb_strcut($row["subject"], 0, 60, "EUC-JP");
if (trim($subject) == "") {
$subject = "(no subject)";
}
示例12: info_page
if (!is_login()) {
info_page('请登录后查看');
}
include_once dirname(__FILE__) . '/function.php';
$data = array();
$tab_type = 'items';
$data['ci_top_title'] = '物品';
$data['tab_type'] = $tab_type;
$data['tab_array'] = $tab_array;
$page = array_shift($args);
$page = intval($page) < 1 ? 1 : intval($page);
$limit = '48';
$start = ($page - 1) * $limit;
$uid = format_uid();
$items = lazy_get_data("select sql_calc_found_rows * from `global_user_items` where `uid` = '{$uid}' and `count` > 0 LIMIT {$start} , {$limit} ");
$all = get_count();
$base = '/app/native/ihome/items';
$page_all = ceil($all / $limit);
$data['pager'] = get_pager($page, $page_all, $base);
$data['list'] = array();
if ($items) {
foreach ($items as $v) {
$iid[] = $v['iid'];
$count[$v['iid']] = $v['count'];
}
$items_info = lazy_get_data("select * from `global_items` where `id` IN(" . join(',', $iid) . ") ");
if ($items_info) {
foreach ($items_info as $v) {
$v['count'] = $count[$v['id']];
$data['list'][] = $v;
}
示例13: exit
echo "clients_disabled.draw LINE2\n";
exit(0);
}
$db = Db::GetDatabaseHandle($baseParams, 'ykval-munin-yubikeystats');
if (!$db->connect()) {
logdie($myLog, 'ERROR Database connect error (1)');
}
function get_count($db, $table, $conditions)
{
$res = $db->customQuery("SELECT count(1) as count FROM {$table} WHERE {$conditions}");
if ($res) {
$r = $res->fetch(PDO::FETCH_ASSOC);
return $r['count'];
}
return Null;
}
if ($count = get_count($db, 'yubikeys', 'active=true')) {
echo "yubikeys_enabled.value {$count}\n";
}
if ($count = get_count($db, 'yubikeys', 'active=false')) {
echo "yubikeys_disabled.value {$count}\n";
}
if ($count = get_count($db, 'yubikeys', 'modified >= ' . (time() - 31 * 86400))) {
echo "yubikeys_1month.value {$count}\n";
}
if ($count = get_count($db, 'clients', 'active=true')) {
echo "clients_enabled.value {$count}\n";
}
if ($count = get_count($db, 'clients', 'active=false')) {
echo "clients_disabled.value {$count}\n";
}
示例14: not_found
if (empty($posts) || $page < 1) {
// a non-existing page
not_found();
}
render('main', array('title' => 'Posts tagged: ' . tag_i18n($tag) . ' - ' . blog_title(), 'description' => 'All posts tagged: ' . tag_i18n($tag) . ' on ' . blog_title() . '.', 'canonical' => site_url() . 'tag/' . strtolower($tag), 'page' => $page, 'posts' => $posts, 'tag' => $ttag, 'bodyclass' => 'intag', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Posts tagged: ' . tag_i18n($tag), 'pagination' => has_pagination($total, $perpage, $page), 'is_tag' => true));
});
// Show the archive page
get('/archive/:req', function ($req) {
if (!login()) {
file_cache($_SERVER['REQUEST_URI']);
}
$page = from($_GET, 'page');
$page = $page ? (int) $page : 1;
$perpage = config('archive.perpage');
$posts = get_archive($req, $page, $perpage);
$total = get_count($req, 'basename');
if (empty($posts) || $page < 1) {
// a non-existing page
not_found();
}
$time = explode('-', $req);
$date = strtotime($req);
if (isset($time[0]) && isset($time[1]) && isset($time[2])) {
$timestamp = date('d F Y', $date);
} elseif (isset($time[0]) && isset($time[1])) {
$timestamp = date('F Y', $date);
} else {
$timestamp = $req;
}
$tarchive = new stdClass();
$tarchive->title = $timestamp;
示例15: stripslashes
$word = stripslashes($word);
}
$word = trim(strip_tags($word));
if (strlen($word) < 2) {
$warn_str = "请输入正确的词汇";
} else {
if (strlen($word) > 30) {
$warn_str = "输入的词语太长了";
} else {
if (strpos($word, ' ') !== false) {
$warn_str = "词汇不要包含空格";
} else {
if (preg_match('/[\\x81-\\xfe]/', $word) && preg_match('/[\\x20-\\x7f]{3}/', $word)) {
$warn_str = "中英混合时字母最多只能出3个以下的连续字母";
} else {
$count = get_count($word);
if ($count < 0) {
$warn_str = "内部原因,计算失败!";
} else {
$res = get_tfidf($word, $count);
}
}
}
}
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新词生词的TF/IDF计算器 - for scws</title>