本文整理匯總了PHP中functions::uint方法的典型用法代碼示例。如果您正苦於以下問題:PHP functions::uint方法的具體用法?PHP functions::uint怎麽用?PHP functions::uint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類functions
的用法示例。
在下文中一共展示了functions::uint方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getAll
public function getAll($sql, $pageCondition = false)
{
if (is_array($pageCondition)) {
$pageCondition['page'] = ($page = functions::uint($pageCondition['page'])) ? $page : 1;
$pageCondition['pagesize'] = ($pagesize = functions::uint($pageCondition['pagesize'])) ? $pagesize : 20;
$resource = odb::db()->getAll($sql);
$rows = count($resource);
$pageInfo = functions::pageInfo($rows, $pageCondition['pagesize'], $pageCondition['page']);
}
$startRow = ($pageCondition['page'] - 1) * $pageCondition['pagesize'];
$sql = is_array($pageCondition) ? $sql . " LIMIT {$startRow}, {$pageCondition['pagesize']}" : $sql;
$list = odb::db()->getAll($sql, MYSQL_ASSOC);
if (is_array($pageCondition)) {
$response = array('list' => $list, 'pageInfo' => $pageInfo);
return $response;
}
return $list;
}
示例2: GetUpdateRecord
/**
* 根據更新時間來,批量取更新數據,同步到DB
* @param $updatetime 上次更新的時間
* @param int $num 從第一頁開始,一次2000條記錄
*/
public function GetUpdateRecord($updatetime, $num = 2000)
{
if (!($num = functions::uint($num))) {
return array();
}
$packet = new SocketPacket();
$packet->WriteBegin(self::CMD_GET_UPDATERECORD);
$packet->WriteInt($updatetime);
$packet->WriteInt($num);
$packet->WriteEnd();
if (!$this->SendData($this->MemDataServer[0], $this->MemDataServer[1], $packet, true)) {
return false;
}
if (($recvLen = @socket_recv($this->aSockets[$this->MemDataServer[0]][$this->MemDataServer[1]], $data, 8192, 0)) === false) {
//4096
Logs::factory()->debug(@implode('-', array(socket_strerror(socket_last_error()), __LINE__, $mid)), 'C_getupdate.txt');
return false;
}
$retPacket = new SocketPacket();
$retPacket->SetRecvPacketBuffer($data, $recvLen);
$ret = $retPacket->ParsePacket();
$ret === 0 or Logs::factory()->debug(array('updatetime' => $updatetime, 'num' => $num, 'ret' => $ret), 'C_getupdate_err.txt');
$value = $retPacket->ReadInt();
//返回的結果,這裏的結果是 有多少個mid,就去多少次,謝謝
for ($i = 1; $i <= $value; $i++) {
//根據mid個數,獲取
$mid = $retPacket->ReadInt();
//讀取mid
$midArr[] = $mid;
}
return $midArr;
//返回mid數組
}
示例3: limit
public function limit($startRow, $count)
{
if (!self::$_rcdata['page']) {
$startRow = ($startRow = functions::uint($startRow)) ? $startRow : 1;
$count = ($count = functions::uint($count)) ? $count : 1;
self::$_rcdata['limit'] = "LIMIT {$startRow}, {$count}";
}
return self::getInstance();
}