本文整理汇总了PHP中fetch函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch函数的具体用法?PHP fetch怎么用?PHP fetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: class_rules
function class_rules($user_id, $tbl_result = "")
{
$this->user_id = $user_id;
$this->login = $tbl_result["login"] == "" ? "Super Admin" : $tbl_result["login"];
$this->listgroupeid = "";
if ($user_id != -1) {
$sql_getPerms = "select shortright from " . __racinebd__ . "droits d inner join " . __racinebd__ . "groupe_droits gd on d.droits_id=gd.droits_id inner join " . __racinebd__ . "groupe_users gu on gd.groupe_id=gu.groupe_id where gu.users_id=" . $user_id . " and droitarbre=0";
$link = query($sql_getPerms);
while ($li = fetch($link)) {
$this->genericRules[$li["shortright"]] = 1;
}
$this->list_groupe_id = implode(",", $listgroupe_id);
$sql_getPerms = "select * from " . __racinebd__ . "groupe_users gu where users_id=" . $user_id;
//print $sql_getPerms;
$link = query($sql_getPerms);
$listgroupe_id = array();
$tmptab = array();
$tmptab[] = 0;
while ($li = fetch($link)) {
$this->groupe_id[$li["groupe_id"]] = 1;
$tmptab[] = $li["groupe_id"];
}
$this->listgroupeid = implode(",", $tmptab) . ",0";
} else {
$this->listgroupeid = 0;
}
}
开发者ID:jcmwc,项目名称:fleet,代码行数:27,代码来源:class_rules.php
示例2: friend_link_check_ajax
function friend_link_check_ajax()
{
global $_G;
$host = $_SERVER['HTTP_HOST'];
$host = str_replace(array('http://', 'https://', '/'), '', $host);
$id = intval($_GET[id]);
$url = $_G[friend_link][$id]['url'];
if (!$url) {
json(array('status' => 'success', 'msg' => '-1'));
} else {
try {
$res = fetch($url);
} catch (Exception $e) {
$res = false;
}
if (!$res) {
$extends = -1;
} elseif (stripos($res, $host) !== false) {
$extends = 1;
} else {
$extends = 0;
}
json(array('status' => 'success', 'msg' => $extends));
}
}
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:25,代码来源:module.action.php
示例3: getDownloadByUrl
/**
* 返回的是分段视频
* @param string $url
* @return array
*/
public function getDownloadByUrl($url)
{
require_once VPARSER_ROOT . '/Common/function.php';
$content = fetch($url);
preg_match_all('/fo\\.addVariable\\(\\"videoCenterId\\"\\,\\"(.*?)\\"\\)\\;/', $content, $arr);
$contents = fetch('http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid=' . $arr[1][0] . '&idl=32&idlr=32&modifyed=false');
$v = json_decode($contents, true);
// [video] => Array
// (
// [validChapterNum] => 2
// [lowChapters] => Array
// (
// [0] => Array
// (
// [image] => http://p4.img.cctvpic.com/fmspic/2015/09/19/cdaae8023379407eb547870805762508-180.jpg
// [url] => http://vod.cntv.lxdns.com/flash/mp4video45/TMS/2015/09/19/cdaae8023379407eb547870805762508_h264200000nero_aac16.mp4
// [duration] => 146
// )
// )
// [totalLength] => 146.00
// [chapters] => Array
// (
// [0] => Array
// (
// [image] => http://p4.img.cctvpic.com/fmspic/2015/09/19/cdaae8023379407eb547870805762508-180.jpg
// [url] => http://vod.cntv.lxdns.com/flash/mp4video45/TMS/2015/09/19/cdaae8023379407eb547870805762508_h264418000nero_aac32.mp4
// [duration] => 146
// )
// )
// [url] =>
// )
$vUrl = $v['video']['chapters'];
return $vUrl;
}
开发者ID:mourinho1908,项目名称:vparser,代码行数:39,代码来源:cntv.php
示例4: svn_clone
function svn_clone($url)
{
#去除多余的url结尾多余的斜杠
$url = trim($url, '/');
$entries_url = $url . '/.svn/entries';
$content = get($entries_url);
if (!$content) {
return debug("{$url} 不是一个合法的svn工作副本!\n", ERROR);
} elseif (strlen($content) < 10) {
return debug("某个东西太短了,需要蓝色小药丸么?\n", ERROR);
}
#匹配出entries中的文件和目录名
preg_match_all('/\\f\\n([^\\n]+?)\\s(\\w+)\\s/s', $content, $m) or debug("{$entries_url} 不包含文件或子目录\n", WARNING);
$files = array_combine($m[1], $m[2]);
foreach ($files as $file => $type) {
if ($type == 'dir') {
debug(">>> 进入 {$file} 目录\n", ALL);
svn_clone($url . '/' . $file);
debug("<<< 退出 {$file} 目录\n", ALL);
} elseif ($type == 'file') {
debug("*** 下载 {$file} 文件\n", ALL);
fetch($url . '/.svn/text-base/' . $file . '.svn-base');
}
}
}
开发者ID:Hacker-One,项目名称:exp,代码行数:25,代码来源:svn.php
示例5: video_js
/**
* PLayer video in video-js player
* @global boolean $pak_player
* @param type $in
* @return boolean
*/
function video_js($in)
{
//Assigning configs so we can easily use them in template..
assign('configs', $in);
//get the file for video...
$files = $in['files'];
$video_files = array();
if ($files) {
foreach ($files as $key => $file) {
if ($key) {
if ($key == 'flv' || $key == 'mp4' || $key == 'mobile') {
$video_file = $file;
break;
}
}
if ($file['status'] == 's' && $file['is_original'] != 'yes') {
$video_file = $file['file_path'];
break;
}
}
}
assign('file', $video_file);
assign('video_files', $video_files);
$player = fetch(VIDEO_JS_DIR . '/player.html', false);
return $player;
}
开发者ID:yukisky,项目名称:clipbucket,代码行数:32,代码来源:videojs.php
示例6: checkMilestone
function checkMilestone($class, $action)
{
if (!$class) {
$action();
return;
}
$milestones = fetchAll("SELECT points FROM milestone ORDER BY points ASC");
$startPoints = array_pop(calculatePoints($class)["points"]);
$action();
$endPoints = array_pop(calculatePoints($class)["points"]);
$achieved = [];
foreach ($milestones as $stone) {
if ($stone->points > $endPoints) {
break;
}
if ($stone->points > $startPoints) {
array_push($achieved, $stone->points);
}
}
if (empty($achieved)) {
return;
}
$classInfo = fetch("SELECT c.name, u.email FROM class AS c JOIN user AS u ON c.teacher = u.id");
$n = "";
if (count($achieved) > 1) {
$n = "n";
}
foreach (fetchAll("SELECT email FROM user WHERE role = :admin", ["admin" => ADMIN]) as $admin) {
own_mail($admin->email, "Etappe{$n} erreicht", "Guten Tag,\r\nDie Klasse \"{$classInfo->name}\" hat die Etappe{$n} " . implode(", ", $achieved) . " erreicht!\r\nDie Lehrkraft ist: {$classInfo->email} \r\n\r\nNachhaltige Grüße\r\nIhre Weltfairsteher-Website");
}
own_mail($classInfo->email, "Etappe{$n} erreicht", "Herzlichen Glückwunsch, Ihre Klasse \"{$classInfo->name}\" hat bei WeltFAIRsteher die Etappe{$n} " . implode(", ", $achieved) . " erreicht!\r\nSie erhalten demnächst eine Überraschung per Post\r\n\r\nNachhaltige Grüße\r\nIhr WeltFAIRsteher-Team");
}
开发者ID:MackieLoeffel,项目名称:weltfairsteher,代码行数:32,代码来源:include.php
示例7: requestAndDisplayCompany
function requestAndDisplayCompany($company)
{
// echo $response;
$companies = fetch('GET', "/v1/company-search?keywords=" . urlencode($company) . "&country-code=us&facet=location,us:0&hq-only=true&");
if ($companies === FALSE) {
restart();
} else {
?>
<html>
<head>
<title>Companies</title>
</head>
<body>
<h1>Expires at: <?php
date_default_timezone_set('America/Los_Angeles');
echo date('l jS \\of F Y h:i:s A', $_SESSION['expires_at']);
?>
</h1>
<br><br>
<h1><?php
echo $companies;
?>
</h1>
</body>
</html>
<?php
}
}
开发者ID:carlos-peru,项目名称:ListCompaniesLinkedInApi,代码行数:28,代码来源:companies.php
示例8: fetch_forums
function fetch_forums()
{
// data to be stored in here
$json = array();
$good = 0;
foreach (self::$feeds as $url) {
$data = fetch($url);
if ($data) {
$good++;
$keep = self::$itemsToKeep;
$rss = simplexml_load_string($data);
foreach ($rss->channel->item as $item) {
if ($keep-- == 0) {
break;
}
$time = strtotime($item->pubDate);
$text = strip_tags($item->description);
if (strlen($text) > 140) {
$text = substr($text, 0, 140) . "…";
}
$json["T{$time}"] = array("time" => $time, "link" => (string) $item->link, "text" => $text);
}
}
}
if (count($json) > 0) {
// sort items by key, newest to oldest
krsort($json);
apc_store(self::$forumKey, json_encode($json));
return true;
} else {
return false;
}
}
开发者ID:browserplus,项目名称:borg,代码行数:33,代码来源:forum.php
示例9: fetch_platform_issues
function fetch_platform_issues()
{
// 1. Fetch the json encoded issues from github
// 2. Iterate thru issues, just keeping data we need (title/number)
// 3. Sort "temp" by updated_at (stored in key)
// 4. Cache sorted json string
$json = fetch(self::$platformIssueUrl);
if ($json) {
// Strip \r\n out of json, otherwise json_decode will fail
$json = str_replace(array(chr(13), chr(10)), array("", ""), $json);
$issues_arr = json_decode($json, 1);
if ($issues_arr) {
$data = array();
foreach ($issues_arr as $issues) {
foreach ($issues as $i) {
// temp key so we can sort array based on date
$ut = strtotime($i["updated_at"]);
$data["T{$ut}"] = $this->get_issue_object($i);
}
}
// newest issues first
krsort($data);
apc_store(self::$platformIssueKey, json_encode(array_values($data)));
return true;
}
}
return false;
}
开发者ID:browserplus,项目名称:borg,代码行数:28,代码来源:git.php
示例10: get_video_info
function get_video_info($id)
{
$html = fetch("http://www.youtube.com/get_video_info?video_id={$id}");
// id: nCnJ_x-QpJM
//
// array (size=8)
// 'errorcode' => string '150' (length=3)
// 'reason' => string 'This video contains content from Quiz Group Pro. It is restricted from playback on certain sites.<br/><u><a href='http://www.youtube.com/watch?v=nCnJ_x-QpJM&feature=player_embedded' target='_blank'>Watch on YouTube</a></u>' (length=222)
// 'status' => string 'fail' (length=4)
// 'eventid' => string 'Aq4qVMLdN4ab-gOroIHwDQ' (length=22)
// 'errordetail' => string '0' (length=1)
// 'csi_page_type' => string 'embed' (length=5)
// 'c' => string 'WEB' (length=3)
// 'enablecsi' => string '1' (length=1)
parse_str($html, $video_info);
if (!empty($video_info['errorcode'])) {
throw new Exception(__FUNCTION__ . ': ' . json_encode($video_info));
}
$tmp = array();
foreach (explode(',', $video_info['url_encoded_fmt_stream_map']) as $stream_str) {
parse_str($stream_str, $stream);
$tmp[] = $stream;
}
$video_info['url_encoded_fmt_stream_map'] = $tmp;
$tmp = array();
foreach (explode(',', $video_info['adaptive_fmts']) as $fmt_str) {
parse_str($fmt_str, $fmt);
$tmp[] = $fmt;
}
$video_info['adaptive_fmts'] = $tmp;
return $video_info;
}
开发者ID:vbarbarosh,项目名称:app_youtube_download_url,代码行数:32,代码来源:youtube_dl.php
示例11: getAllSubCategories
function getAllSubCategories($filename)
{
$categories = unserialize(file_get_contents($filename));
echo "---- run getAllSubCategories() ----\n\r";
foreach ($categories as $j => $category) {
if ($category['childrens']) {
foreach ($category['childrens'] as $k => $children) {
echo "---- crawling childrens for {$children['name']} ----\n\r";
$doc = phpQuery::newDocumentHTML(fetch('http://www.walmart.com' . $children['link']));
phpQuery::selectDocument($doc);
foreach (pq('.shop-by-category li') as $el) {
echo "---- " . pq($el)->find('a')->attr('href') . "} ----\n\r";
$childrens[] = array('name' => pq($el)->find('a')->data('name'), 'link' => pq($el)->find('a')->attr('href'));
}
$categories[$j]['childrens'][$k]['childrens'] = $childrens;
}
}
}
echo "---- creating deparment file ----\n\r";
$file = fopen($filename, 'w+');
echo "---- writing deparment file ----\n\r";
fputs($file, serialize($categories));
echo "---- closing deparment file ----\n\r";
fclose($file);
}
开发者ID:josueaponte7,项目名称:necotienda_standalone,代码行数:25,代码来源:walmart-v-0.1.php
示例12: adjust_tags
function adjust_tags($from, $layout = FALSE)
{
static $open = '/\\s*<(script|style)[^>]*?>.*?<\\/\\1>\\s*/s', $close = '/\\s*<(meta|link)[^>]*?\\/?>\\s*/s', $header = '/<(head)[^<>]*>(.+?)<\\/\\1>/s', $descript = '/<title>(.+?)<\\/title>/s';
if (preg_match('/^(?:<html|["\'\\[{])/', $from)) {
return $from;
}
$separator = option('separator') ?: ' - ';
$top_title = option('title');
$sub_title = fetch('title');
$raw = $head = $body = $title = $stack = array();
$collect = function ($match) use(&$stack) {
$stack[] = array('tag' => $match[1], 'full' => trim($match[0]));
};
$from = preg_replace_callback($header, function ($match) use(&$raw) {
$raw[] = $match[2];
}, $from);
preg_match($descript, $layout, $match) && ($top_title = $match[1]);
preg_match($descript, $from, $match) && ($sub_title = $match[1]);
$top_title && ($title[] = trim($top_title));
$sub_title && ($title[] = trim($sub_title));
$layout = preg_replace($descript, '', $layout);
$from = preg_replace($descript, '', $from);
$from = preg_replace_callback($open, $collect, $from);
$from = preg_replace_callback($close, $collect, $from);
foreach ($stack as $one) {
$one['tag'] === 'script' ? $body[] = $one['full'] : ($head[] = $one['full']);
}
while ($head[] = array_shift($raw)) {
}
$from = preg_replace('/<(body)([^<>]*?)>/', "<\\1\\2>\n{$from}", $layout);
$from = str_replace('</head>', sprintf("%s\n</head>", join("\n", $head)), $from);
$from = str_replace('</body>', sprintf("%s\n</body>", join("\n", $body)), $from);
$from = str_replace('</head>', sprintf("<title>%s</title>\n</head>", join($separator, $title)), $from);
return $from;
}
开发者ID:hbnro,项目名称:habanero,代码行数:35,代码来源:functions.php
示例13: replaceTag
/**
* 编译并返回内容
* @param unknown_type $attr
* @param unknown_type $value
* @param unknown_type $tagInfo
* @return Ambigous <void, mixed>|string
*/
public function replaceTag($attr, $value = '', $tagInfo)
{
$this->init($attr, $value);
//调用子类的replace方法把参数引入
$var = $this->replace();
return fetch($this->templateFile, $var);
}
开发者ID:lyhiving,项目名称:icampus,代码行数:14,代码来源:TagsAbstract.class.php
示例14: page_edit
/**
* The main Page editor panel.
*
* @param string|array $message The activity message
*/
function page_edit($message = '')
{
global $event, $step;
pagetop(gTxt('edit_pages'), $message);
extract(array_map('assert_string', gpsa(array('copy', 'save_error', 'savenew'))));
$name = sanitizeForPage(assert_string(gps('name')));
$newname = sanitizeForPage(assert_string(gps('newname')));
if ($step == 'page_delete' || empty($name) && $step != 'page_new' && !$savenew) {
$name = safe_field('page', 'txp_section', "name = 'default'");
} elseif ((($copy || $savenew) && $newname || $newname && $newname != $name) && !$save_error) {
$name = $newname;
}
$buttons = n . tag(gTxt('page_name'), 'label', array('for' => 'new_page')) . br . fInput('text', 'newname', $name, 'input-medium', '', '', INPUT_MEDIUM, '', 'new_page', false, true);
if ($name) {
$buttons .= span(href(gTxt('duplicate'), '#', array('id' => 'txp_clone', 'class' => 'clone', 'title' => gTxt('page_clone'))), array('class' => 'txp-actions'));
} else {
$buttons .= hInput('savenew', 'savenew');
}
$html = !$save_error ? fetch('user_html', 'txp_page', 'name', $name) : gps('html');
// Format of each entry is popTagLink -> array ( gTxt() string, class/ID).
$tagbuild_items = array('page_article' => array('page_article_hed', 'article-tags'), 'page_article_nav' => array('page_article_nav_hed', 'article-nav-tags'), 'page_nav' => array('page_nav_hed', 'nav-tags'), 'page_xml' => array('page_xml_hed', 'xml-tags'), 'page_misc' => array('page_misc_hed', 'misc-tags'), 'page_file' => array('page_file_hed', 'file-tags'));
$tagbuild_links = '';
foreach ($tagbuild_items as $tb => $item) {
$tagbuild_links .= wrapRegion($item[1] . '_group', taglinks($tb), $item[1], $item[0], 'page_' . $item[1]);
}
echo hed(gTxt('tab_pages'), 1, array('class' => 'txp-heading'));
echo n . tag(n . tag(hed(gTxt('tagbuilder'), 2) . $tagbuild_links, 'div', array('id' => 'tagbuild_links', 'class' => 'txp-layout-cell txp-layout-1-4')) . n . tag(form(graf($buttons) . graf(tag(gTxt('page_code'), 'label', array('for' => 'html')) . br . '<textarea class="code" id="html" name="html" cols="' . INPUT_LARGE . '" rows="' . TEXTAREA_HEIGHT_LARGE . '" dir="ltr">' . txpspecialchars($html) . '</textarea>') . graf(fInput('submit', '', gTxt('save'), 'publish') . eInput('page') . sInput('page_save') . hInput('name', $name)), '', '', 'post', 'edit-form', '', 'page_form'), 'div', array('id' => 'main_content', 'class' => 'txp-layout-cell txp-layout-2-4')) . n . tag(graf(sLink('page', 'page_new', gTxt('create_new_page')), ' class="action-create"') . page_list($name) . n, 'div', array('id' => 'content_switcher', 'class' => 'txp-layout-cell txp-layout-1-4')) . n, 'div', array('id' => $event . '_container', 'class' => 'txp-layout-grid'));
}
开发者ID:hcgtv,项目名称:textpattern,代码行数:33,代码来源:txp_page.php
示例15: section_create
function section_create()
{
global $txpcfg;
$name = ps('name');
//Prevent non url chars on section names
include_once txpath . '/lib/classTextile.php';
$textile = new Textile();
$title = $textile->TextileThis($name, 1);
$name = strtolower(sanitizeForUrl($name));
$chk = fetch('name', 'txp_section', 'name', $name);
if (!$chk) {
if ($name) {
$default = doSlash(safe_row('page, css', 'txp_section', "name = 'default'"));
$rs = safe_insert("txp_section", "name = '" . doSlash($name) . "',\n\t\t\t\t\ttitle = '" . doSlash($title) . "',\n\t\t\t\t\tpage = '" . $default['page'] . "',\n\t\t\t\t\tcss = '" . $default['css'] . "',\n\t\t\t\t\tis_default = 0,\n\t\t\t\t\tin_rss = 1,\n\t\t\t\t\ton_frontpage = 1");
if ($rs) {
update_lastmod();
$message = gTxt('section_created', array('{name}' => $name));
sec_section_list($message);
}
} else {
sec_section_list();
}
} else {
$message = array(gTxt('section_name_already_exists', array('{name}' => $name)), E_ERROR);
sec_section_list($message);
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:27,代码来源:txp_section.php
示例16: bb2_db_rows
function bb2_db_rows($result)
{
$array = array();
while ($resultRow = fetch($result)) {
$array[] = $resultRow;
}
return $array;
}
开发者ID:RoadrunnerWMC,项目名称:ABXD-plugins,代码行数:8,代码来源:init.php
示例17: getDownloadById
public function getDownloadById($vid)
{
require_once VPARSER_ROOT . '/Common/function.php';
$data = fetch('http://www.yinyuetai.com/insite/get-video-info?videoId=' . $vid . '&flex=true');
preg_match_all('|(http://[a-z]{2}.yinyuetai.com/uploads/videos/common/[^&]+)&br=|', $data, $vUrl);
$vUrl = $vUrl[1];
return $vUrl;
}
开发者ID:mourinho1908,项目名称:vparser,代码行数:8,代码来源:yinyuetai.php
示例18: pull_all_comments
function pull_all_comments($post_id)
{
$query = "SELECT concat(users.name_first,' ',users.name_last) as user_name,\n\t\t\t\t\t\t\t comments.id as comment_id,\n\t\t\t\t\t\t\t comments.content as comment_content,\n\t\t\t\t\t\t\t comments.user_id as user_who_commented,\n\t\t\t\t\t\t\t comments.created_at as comment_date \n\t\t\t\t\t\t\t FROM comments\n\t\t\t\t\t\t\tJOIN users ON users.id = comments.user_id\n\t\t\t\t\t\t\t-- JOIN posts ON posts.id = comments.user_id\n\t\t\t\t\t\t\tWHERE comments.post_id = {$post_id}\n\t\t\t\t\t\t\tORDER BY comment_date DESC;";
// var_dump($query);
// die();
return fetch($query);
// returns array
}
开发者ID:stormywake,项目名称:the-wall,代码行数:8,代码来源:post_process.php
示例19: fetchdata
function fetchdata($fromdate, $todate)
{
$user = fetch('GET', '/user/profile');
$user2 = fetch('GET', '/user/summary/daily?from=' . $fromdate . '&to=' . $todate . '');
print_r($user2);
$userid = $user->userId;
insertindatabase($user2, $userid);
}
开发者ID:MohammedHamdy,项目名称:moves-api,代码行数:8,代码来源:index.php
示例20: get_rides
function get_rides()
{
if (isset($_SESSION['school_id'])) {
$query = "SELECT token FROM schools WHERE id = {$_POST['school_id']}";
return fetch($query);
} else {
return "Please log in.";
}
}
开发者ID:johnhalbert,项目名称:rides4kidz,代码行数:9,代码来源:functions.php
注:本文中的fetch函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论