本文整理汇总了PHP中getPage函数的典型用法代码示例。如果您正苦于以下问题:PHP getPage函数的具体用法?PHP getPage怎么用?PHP getPage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPager
/**
* 功能:
* by:
* 参数:
* $data=array(
'condition'=>array(
'列名'=>array('值','条件','列类型'),
'列名'=>array('值','条件','列类型'),
...
),
'pg'=>'当前页',
'order'=>'排序处理',
'cols'=>'列1,列2,列3...',
'pageSize'=>'查询限制:15',
'pageStrategy'=>'分页策略,默认为getNormalPage',
'trueTableName'=>'表全名',
'extWhere'=>'拓展条件查询'
);
* 返回:
* 日期:
* 修改人:
* 修改时间:
* 备注:
* 1.支持的列类型有 int,smallint,tinyint,mediumint,float,double,BOOL
* 2.条件包括:= != LIKE IN BETWEEN % %%
*/
public function getPager(&$data)
{
//基本数据处理
$this->pageSize = isset($data['pageSize']) ? (int) $data['pageSize'] : $this->pageSize;
$this->PG = getPage();
$where = $this->getWhere($data['condition']);
if (isset($data['extWhere']) && $data['extWhere']) {
$this->extWhere = ' ' . $data['extWhere'];
}
$this->trueTableName = $data['trueTableName'];
$this->handle = M($this->trueTableName);
$cols = isset($data['cols']) ? $data['cols'] : '*';
$total = $this->getTotal($where);
$this->pageCount = ceil($total / $this->pageSize);
$s = ($this->PG - 1) * $this->pageSize;
$order = isset($data['order']) ? $this->getOrder($data['order']) : '';
$limit = $this->getLimit($s);
$rs = $this->getData($cols, $where, $order, $limit);
$pageHTML = $this->getNormalPage($this->PG, $this->pageCount);
//策略处理
if (isset($data['pageStrategy']) && !empty($data['pageStrategy'])) {
if (is_array($data['pageStrategy'])) {
$pageHTML = call_user_func($data['pageStrategy'], $this->PG, $this->pageCount, $total);
} else {
$pageHTML = call_user_func(array($this, $data['pageStrategy'] . 'Strategy'), $this->PG, $this->pageCount, $total);
}
} else {
$pageHTML = $this->getNormalPage($this->PG, $this->pageCount);
}
return array('data' => $rs, 'paging' => $pageHTML);
}
示例2: parseMovie
static function parseMovie($id, $p_code)
{
$url = replaceStr(SinaTeachParse::BASE_SHOW_EPISODE, '{COURSE_ID}', $id);
$content = getPage($url, $p_code);
$content = json_decode($content);
if (is_object($content) && property_exists($content, 'result') && property_exists($content->result, 'data') && property_exists($content->result->data, 'lessoninfo')) {
$contents = $content->result->data->lessoninfo;
if (is_array($contents) && count($contents) > 0) {
$sites = array();
$site = array();
$site['site_url'] = "sina";
$site['site_name'] = "sinahd";
$site['max_episode'] = 'true';
$episodes = array();
foreach ($contents as $content) {
$episodes[] = array('name' => property_exists($content, 'name') ? $content->name : "1", 'guest' => property_exists($content, 'short_name') ? $content->short_name : "1", 'episode' => property_exists($content, 'jieci') ? $content->jieci : "1", 'url' => property_exists($content, 'burl') ? $content->burl : "", 'img_url' => property_exists($content, 'thumb') ? $content->thumb : "", 'time' => property_exists($content, 'length') ? $content->length : "", 'stream_url' => property_exists($content, 'stream_url') && !isN($content->stream_url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->stream_url : "", 'androidUrl' => property_exists($content, 'android_url') && !isN($content->android_url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->android_url : "", 'videoAddressUrl' => property_exists($content, 'ipad_url') && !isN($content->ipad_url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->ipad_url : "");
}
$site['episodes'] = $episodes;
$sites[] = $site;
// var_dump($episodes);
return $sites;
}
}
return false;
}
示例3: scrap_amazon_all
function scrap_amazon_all($asin)
{
$url = "http://www.amazon.com/dp/" . $asin;
$result['url'] = $url;
//$url="http://www.amazon.com/gp/offer-listing/".$asin."/ref=dp_olp_new&condition=new";
$data = getPage($url);
preg_match_all("%http://ecx.images-amazon.com/images/I/\\w+.jpg%", $data, $matches);
$imgs = array_unique($matches[0]);
$html = str_get_html($data);
$ok = 0;
foreach ($html->find('h1[id=title]') as $title) {
$ok = 1;
}
if ($ok == 1) {
$result['scrapok'] = 1;
} else {
$result['scrapok'] = 0;
return $result;
}
$price = floatval(str_replace('$', '', $html->find('#priceblock_saleprice,#priceblock_ourprice', 0)->plaintext));
$q = count((array) $html->find('#quantity option'));
$prime = (!$price or @$html->find('#soldByThirdParty', 0)->plaintext) ? 'No' : 'Yes';
$features = array_map(function ($el) {
return $el->plaintext;
}, (array) $html->find('#feature-bullets li'));
$desc = @$html->find('#productDescription', 0)->plaintext || '';
$result = array('quantity' => intval($q), 'offerprice' => $price, 'sku' => $asin, 'prime' => $prime, 'url' => $url, 'title' => $html->find('#productTitle', 0)->plaintext, 'features' => $features, 'desc' => $desc, 'img' => $imgs);
return $result;
}
示例4: parseMovie
static function parseMovie($id, $p_code, $info)
{
$url = replaceStr(NeteaseTeachParse::BASE_SHOW_EPISODE, '{COURSE_ID}', $id);
$content = getPage($url, $p_code);
$content = json_decode($content);
if (is_object($content)) {
$info->actor = property_exists($content, 'director') ? $content->director : "";
$info->brief = property_exists($content, 'description') ? $content->description : "";
$contents = property_exists($content, 'videoList') ? $content->videoList : array();
if (is_array($contents) && count($contents) > 0) {
$sites = array();
$site = array();
$site['site_url'] = "126";
$site['site_name'] = "126";
$site['max_episode'] = 'true';
$episodes = array();
foreach ($contents as $content) {
$episodes[] = array('name' => property_exists($content, 'title') ? $content->title : "", 'guest' => property_exists($content, 'subtitle') ? $content->subtitle : "", 'episode' => property_exists($content, 'pnumber') ? $content->pnumber : "", 'url' => property_exists($content, 'weburl') ? $content->weburl : "", 'img_url' => property_exists($content, 'imgpath') ? $content->imgpath : "", 'androidUrl' => property_exists($content, 'repovideourl') && !isN($content->repovideourl) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->repovideourl : "", 'videoAddressUrl' => property_exists($content, 'repoMP3url') && !isN($content->repoMP3url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->repoMP3url : "");
}
$site['episodes'] = $episodes;
$sites[] = $site;
// var_dump($episodes);
return $sites;
}
}
return false;
}
示例5: parseVideoIOSUrls
function parseVideoIOSUrls($sql)
{
global $db;
writetofile("parseVideo.txt", $sql);
$rs = $db->query($sql);
$rscount = $db->num_rows($rs);
if ($rscount == 0) {
errmsg("没有可用的数据");
} else {
while ($row = $db->fetch_array($rs)) {
$u_id = $row["u_id"];
$u_weburl = $row["u_weburl"];
$p_id = $row["p_id"];
$m_urltest = $row["m_urltest"];
if (isN($u_weburl)) {
$u_weburl = $m_urltest;
}
$project = getProgject($p_id);
$webCode = getPage($u_weburl, $project->p_coding);
// $videoUrl = crawleVideoByPlayUrl($webCode,$project);
$videoUrl = ContentProviderFactory::getContentProvider($project->p_playtype)->parseIOSVideoUrlByContent($webCode, $project->p_coding, $project->p_script);
writetofile("android_log.txt", $strlink . '{===}' . $androidUrl);
if (!isN($videoUrl)) {
$sql = "update {pre}cj_vod_url set iso_video_url='" . $videoUrl . "', u_weburl='" . $u_weburl . "',android_vedio_url ='" . $androidUrl . "' where u_id=" . $u_id;
writetofile("parseVideo.txt", $sql);
$db->query($sql);
} else {
writetofile("videoUrlErrors.txt", '{===}' . $p_id . '{===}' . $u_id . '{===}' . $u_weburl);
}
}
}
unset($rs);
}
示例6: parseChannel
function parseChannel($area, $url, $stationname)
{
global $db;
$contents = getPage($url, "");
$content = getBody($contents, '<div class="listmenu2" >', '<div class="listmenu" >');
if ($content === false || isN($content)) {
$content = getBodys($contents, '<div class="listmenu2" >');
}
// var_dump($content);
$codes = getArray($content, "/program/", '</a>');
//
$codesArray = explode("{Array}", $codes);
////http://epg.tvsou.com/program/
$channels = array();
$currentStation = getBody($content, '<font color="#FF6600">', '</font>');
$channels[$area . '{Array}' . $stationname . '{Array}' . $currentStation] = $url;
foreach ($codesArray as $code) {
$ste = explode('"class=blue2>', $code);
if (!isN($ste[1])) {
$channels[$area . '{Array}' . $stationname . '{Array}' . $ste[1]] = 'http://epg.tvsou.com/program/' . $ste[0];
}
}
//var_dump($channels);
return $channels;
}
示例7: crawleAndroidVideoByPlayUrl
function crawleAndroidVideoByPlayUrl($url, $project)
{
$webCode = getPage($url, $project->p_coding);
$androidUrl = ContentProviderFactory::getContentProvider($project->p_playtype)->parseAndroidVideoUrlByContent($webCode, $project->p_coding, $project->p_script);
writetofile("android_log.txt", $strlink . '{===}' . $androidUrl);
return $androidUrl;
}
示例8: parseIOSVideoUrl
public function parseIOSVideoUrl($url, $p_coding, $p_script)
{
$content = getPage($this->p_videocodeApiUrl . $this->from . '/?url=' . $url, "utf-8");
// var_dump($url);
writetofile("joyplus.log", $this->p_videocodeApiUrl . $this->from . '/?url=' . $url);
return $this->parseIOSVideoUrlByContent($content, $p_coding, $p_script);
}
示例9: from_tumblr
function from_tumblr()
{
global $sessionkey;
$db = get_db_connectiuon();
list($sessionkey, $cookies, $u) = get_login_cookie($db);
$page = getPage();
$agent = Net_UserAgent_Mobile::singleton();
// paging a page
if ($agent->isDoCoMo()) {
$page = ceil($page / 2);
}
//$postid = getPostId();
$url = 'http://www.tumblr.com/dashboard/';
if ($page > 1) {
$url .= $page;
}
if ($postid > 1) {
$url .= "/{$postid}";
}
#print "<!--$url-->";
$retry = 2;
while ($retry--) {
$req =& new HTTP_Request($url);
$req->setMethod(HTTP_REQUEST_METHOD_GET);
foreach ($cookies as $v) {
$req->addCookie($v['name'], $v['value']);
}
if (PEAR::isError($req->sendRequest())) {
$err = 1;
}
$code = $req->getResponseCode();
if ($code == 302) {
$err = true;
if ($u['email']) {
list($err, $cookies) = update_cookie_info($u['email'], $u['password'], true, $u['hash']);
}
if ($err) {
$retry = 0;
break;
}
} else {
if ($code == 200) {
return $req->getResponseBody();
} else {
print '<html><body><pre>x_x';
print " {$code} ";
print '</body></html>';
exit;
}
}
}
if ($retry == 0) {
header('Location: /login');
} else {
print '<html><body><pre>x_x';
print '</body></html>';
}
exit;
}
示例10: __construct
function __construct()
{
$post_id = $_REQUEST['id'];
$this->db = $db = get_db_connectiuon();
list($sessionkey, $cookies) = get_login_cookie($db);
$this->sessionkey = $sessionkey;
$this->page = $page = getPage();
}
示例11: messager
public function messager()
{
$ip = ipDecode(get_client_ip());
$messagers = D('Messagers');
$page = getPage($messagers, 5, "ip = {$ip}");
$list = $messagers->field(true)->order('id DESC')->limit($page->firstRow . ',' . $page->listRows)->select();
$this->assign('page', $page->show());
$this->assign('messagers', $list);
$this->display();
}
示例12: getLZLReplyList
public function getLZLReplyList($to_f_reply_id, $order, $page = 1, $limit = 3)
{
$list = M('GroupLzlReply')->where('status=1 and to_f_reply_id=' . $to_f_reply_id)->order($order)->select();
foreach ($list as $k => &$v) {
$v['userInfo'] = query_user(array('avatar128', 'nickname', 'uid', 'space_url'), $v['uid']);
$v['content'] = parse_weibo_mobile_content($v['content']);
}
unset($v);
$list = getPage($list, $limit, $page);
return $list;
}
示例13: scrape_overstock
function scrape_overstock($itemid)
{
$result = array();
$url = "http://www.overstock.com/search/" . $itemid;
//echo $url;
$data = getPage($url);
$result['itemid'] = $itemid;
$html = str_get_html($data);
foreach ($html->find('div[id=prod_mainCenter] h1') as $title) {
$result['title'] = $title->plaintext;
break;
}
foreach ($html->find('ul[class=bulleted-list]') as $description) {
$result['description'] = $description->plaintext;
break;
}
$result['description'] = str_replace('more', '', $result['description']);
foreach ($html->find('div[id=proImageHero] div[class=proImageStack] img') as $image) {
$result['imageurl'] = $image->src;
break;
}
$result['imageurl'] = str_replace('_320', '_1000', $result['imageurl']);
$i = 0;
foreach ($html->find('div[id=proImageHero]') as $divimage) {
//echo $divimage;die;
foreach ($divimage->find('img') as $img) {
$result['pictures' . $i] = $img->src;
$result['pictures' . $i] = str_replace('_320', '_80', $result['pictures' . $i]);
$i++;
}
}
//}
foreach ($html->find('span[class=price_sale main-price-red] span[class=Ovalue main-price-red]') as $price) {
$result['price'] = $price->plaintext;
break;
}
$qte = 0;
foreach ($html->find('div[id=addCartMain_quantity] select') as $select) {
foreach ($select->find('option') as $opt) {
$qte++;
}
}
$result['quantity'] = $qte;
foreach ($html->find('ul[id=details_descFull]') as $features) {
$result['features'] = $features;
break;
}
foreach ($html->find('div[class=product-brand-name] a') as $brand) {
$result['brand'] = $brand->plaintext;
break;
}
$result['prime'] = 'Yes';
return $result;
}
示例14: getVideoUrlByProjectAndUrl
function getVideoUrlByProjectAndUrl($url, $pid)
{
// global $db;
$project = getProgject($pid);
$webCode = getPage($url, $project->p_coding);
$videoUrl = ContentProviderFactory::getContentProvider($project->p_playtype)->parseIOSVideoUrlByContent($webCode, $project->p_coding, $project->p_script);
$androidUrl = ContentProviderFactory::getContentProvider($project->p_playtype)->parseAndroidVideoUrlByContent($webCode, $project->p_coding, $project->p_script);
if (!isN($videoUrl) || !isN($androidUrl)) {
return $videoUrl . MovieType::VIDEO_SEP_VERSION . $androidUrl;
} else {
return "Can't find";
}
}
示例15: crawlerProgramItems
static function crawlerProgramItems($date, $chnnel)
{
$dateTime = strtotime($date);
$date = date('w', $dateTime);
if ($date === '0') {
$date = '7';
}
$url = replaceStr(TVSouLiveParse::BASE_EPISODE, '{DATE}', $date);
$url = replaceStr($url, '{TV_CODE}', $chnnel);
$content = getPage($url, "gb2312");
writetofile("program_live_item_crawler.log", "url:[" . $url . "]");
// var_dump($url);
return TVSouLiveParse::parseMovieInfoByContent($content, $p_code, $type);
}