本文整理汇总了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();
}