本文整理汇总了PHP中dintval函数的典型用法代码示例。如果您正苦于以下问题:PHP dintval函数的具体用法?PHP dintval怎么用?PHP dintval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dintval函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: increase
public function increase($tids, $fieldarr)
{
$tids = dintval((array) $tids, true);
$sql = array();
$num = 0;
$allowkey = array('replies', 'lastposter', 'lastpost');
foreach ($fieldarr as $key => $value) {
if (in_array($key, $allowkey)) {
if (is_array($value)) {
$sql[] = DB::field($key, $value[0]);
} else {
$value = dintval($value);
$sql[] = "`{$key}`=`{$key}`+'{$value}'";
}
} else {
unset($fieldarr[$key]);
}
}
if ($getsetarr) {
return $sql;
}
if (!empty($sql)) {
$cmd = "UPDATE ";
$num = DB::query($cmd . DB::table($this->_table) . " SET " . implode(',', $sql) . " WHERE tid IN (" . dimplode($tids) . ")", 'UNBUFFERED');
$this->increase_cache($tids, $fieldarr);
}
return $num;
}
示例2: repair_htmlmade
public function repair_htmlmade($ids)
{
if ($ids = dintval($ids, true)) {
return DB::update($this->_table, array('htmlmade' => 0), DB::field($this->_pk, $ids));
}
return false;
}
示例3: fetch_all_will_birthday_by_uid
public function fetch_all_will_birthday_by_uid($uids)
{
$birthlist = array();
if (!empty($uids)) {
$uids = explode(',', (string) $uids);
$uids = dimplode(dintval($uids, true));
list($s_month, $s_day) = explode('-', dgmdate(TIMESTAMP - 3600 * 24 * 3, 'n-j'));
list($n_month, $n_day) = explode('-', dgmdate(TIMESTAMP, 'n-j'));
list($e_month, $e_day) = explode('-', dgmdate(TIMESTAMP + 3600 * 24 * 7, 'n-j'));
if ($e_month == $s_month) {
$wheresql = "sf.birthmonth='{$s_month}' AND sf.birthday>='{$s_day}' AND sf.birthday<='{$e_day}'";
} else {
$wheresql = "(sf.birthmonth='{$s_month}' AND sf.birthday>='{$s_day}') OR (sf.birthmonth='{$e_month}' AND sf.birthday<='{$e_day}' AND sf.birthday>'0')";
}
$query = DB::query("SELECT sf.uid,sf.birthyear,sf.birthmonth,sf.birthday,s.username\n\t\t\t\tFROM " . DB::table('common_member_profile') . " sf\n\t\t\t\tLEFT JOIN " . DB::table('common_member') . " s USING(uid)\n\t\t\t\tWHERE (sf.uid IN ({$uids})) AND ({$wheresql})");
while ($value = DB::fetch($query)) {
$value['istoday'] = 0;
if ($value['birthmonth'] == $n_month && $value['birthday'] == $n_day) {
$value['istoday'] = 1;
}
$key = sprintf("%02d", $value['birthmonth']) . sprintf("%02d", $value['birthday']);
$birthlist[$key][] = $value;
ksort($birthlist);
}
}
return $birthlist;
}
示例4: update_by_id_username
public function update_by_id_username($id, $data, $username, $adminid = 1)
{
if (($id = dintval($id, true)) && $data && is_array($data)) {
$adminid = dintval($adminid);
DB::update($this->_table, $data, DB::field($this->_pk, $id) . " AND ('{$adminid}'=1 OR " . DB::field('author', $username) . ')', true);
}
}
示例5: fetch_all_by_uid_dateline
public function fetch_all_by_uid_dateline($uids, $findex = true, $start = 0, $limit = 5)
{
if (!($uids = dintval($uids, true))) {
return null;
}
return DB::fetch_all('SELECT * FROM %t ' . ($findex ? 'USE INDEX(dateline)' : '') . ' WHERE uid IN (%n) ORDER BY dateline desc %i', array($this->_table, $uids, DB::limit($start, $limit)));
}
示例6: delete_by_uid
public function delete_by_uid($uids)
{
$uids = dintval((array) $uids, true);
if (!empty($uids)) {
return DB::delete($this->_table, DB::field('uid', $uids));
}
return 0;
}
示例7: delete_by_tid
public function delete_by_tid($tids)
{
$tids = dintval($tids, true);
if ($tids) {
return DB::delete($this->_table, DB::field('tid', $tids));
}
return 0;
}
示例8: delete_by_dateline
public function delete_by_dateline($dateline)
{
$dateline = dintval($dateline);
if ($dateline) {
return DB::delete($this->_table, DB::field('dateline', $dateline, '<'));
}
return 0;
}
示例9: update_by_groupid
public function update_by_groupid($groupid, $data)
{
$groupid = is_array($groupid) ? array_map('intval', (array) $groupid) : dintval($groupid);
if ($groupid && $data && is_array($data)) {
return DB::update($this->_table, $data, DB::field('groupid', $groupid));
}
return 0;
}
示例10: delete_by_uid_or_fuid
public function delete_by_uid_or_fuid($uids)
{
$uids = dintval($uids, true);
if (!$uids) {
return null;
}
DB::delete($this->_table, DB::field('uid', $uids) . ' OR ' . DB::field('fuid', $uids));
}
示例11: fetch_all_hotarticle
public function fetch_all_hotarticle($wheresql, $dateline)
{
if (!empty($wheresql) && ($wheresql = (string) $wheresql) && ($dateline = dintval($dateline))) {
return DB::fetch_all("SELECT at.* FROM " . DB::table($this->_table) . " ac, " . DB::table('portal_article_title') . " at WHERE {$wheresql} AND at.dateline>'{$dateline}' AND ac.aid=at.aid ORDER BY ac.viewnum DESC LIMIT 10");
} else {
return array();
}
}
示例12: delete_by_menuid
public function delete_by_menuid($menutype, $ids)
{
$ids = dintval($ids, is_array($ids) ? true : false);
if ($ids) {
return DB::delete($this->_table, DB::field('menuid', $ids) . ' AND ' . DB::field('type', $menutype));
}
return 0;
}
示例13: delete_by_uid
public function delete_by_uid($uids)
{
$uids = dintval($uids, is_array($uids) ? true : false);
if ($uids) {
return DB::delete($this->_table, DB::field('uid', $uids));
}
return 0;
}
示例14: fetch_all_by_upid
public function fetch_all_by_upid($upid, $order = null, $sort = 'DESC')
{
$upid = is_array($upid) ? array_map('intval', (array) $upid) : dintval($upid);
if ($upid !== null) {
$ordersql = $order !== null && !empty($order) ? ' ORDER BY ' . DB::order($order, $sort) : '';
return DB::fetch_all('SELECT * FROM %t WHERE ' . DB::field('upid', $upid) . " {$ordersql}", array($this->_table), $this->_pk);
}
return array();
}
示例15: delete_by_id_fid
public function delete_by_id_fid($id, $fid)
{
$id = dintval($id, is_array($id) ? true : false);
$fid = dintval($fid, is_array($fid) ? true : false);
if (is_array($id) && empty($id) || is_array($fid) && empty($fid)) {
return 0;
}
return DB::delete($this->_table, DB::field('id', $id) . ' AND ' . DB::field('fid', $fid));
}