当前位置: 首页>>代码示例>>PHP>>正文


PHP download函数代码示例

本文整理汇总了PHP中download函数的典型用法代码示例。如果您正苦于以下问题:PHP download函数的具体用法?PHP download怎么用?PHP download使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了download函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doPush

 function doPush()
 {
     $db = new db();
     $did = -1;
     if (isset($_SESSION['email'])) {
         $did = $db->addDownload($_SESSION['email'], $this->fileName, '推送', '准备推送');
     }
     $info = 'error';
     download($this->fileName);
     try {
         $info = pushToEmail($this->e, $this->fileName);
     } catch (Exception $e) {
         if ($did != -1) {
             $db->updateDownloadStatus($did, '失败');
         }
         echo 'error';
         exit;
     }
     if ($info == 'success') {
         if ($did != -1) {
             $db->updateDownloadStatus($did, '成功');
         }
         echo 'success';
     } else {
         if ($did != -1) {
             $db->updateDownloadStatus($did, '失败');
         }
         echo 'error';
     }
 }
开发者ID:andy-sheng,项目名称:ebook,代码行数:30,代码来源:PushController.class.php

示例2: handle

 function handle()
 {
     //$storage = new JingdongStorageService(accesskey, secrectkey);
     /*
     $fileName = uniqid().'.mobi';
     $filePath = 'tmp/' + $fileName;
     $fp = fopen($filePath, 'wb+');
     
     
     if($fp){
     	        	$storage->get_object(bookbucket,$this->bid,$fp, false);
     	        	
     }
     else
     	echo 'error';
     */
     $filePath = './jae/' . $this->bid;
     if (!file_exists($filePath)) {
         download($this->bid);
     }
     $fp = fopen($filePath, 'r');
     Header("Content-type: application/octet-stream");
     Header("Accept-Ranges: bytes");
     Header("Accept-Length: " . filesize($filePath));
     Header("Content-Disposition: attachment; filename=" . $this->bid);
     echo fread($fp, filesize($filePath));
     fclose($fp);
     if (isset($_SESSION['email'])) {
         $email = $_SESSION['email'];
         $db = new db();
         $db->addDownload($email, $this->bid, '下载', '成功');
     }
 }
开发者ID:andy-sheng,项目名称:ebook,代码行数:33,代码来源:DownloadController.class.php

示例3: export_begin

 function export_begin($keys, $type, $count)
 {
     download($type . '-' . date('YmdHis') . '(' . $count . ').csv');
     if ($keys) {
         $this->export_rows(array($keys));
     }
 }
开发者ID:noikiy,项目名称:shopex_tmall,代码行数:7,代码来源:io.taobaogoodscsv.php

示例4: downloadFiles

function downloadFiles()
{
    global $types;
    foreach ($types as $name) {
        download($name);
    }
}
开发者ID:xXSparkeyy,项目名称:harbour-spritradar,代码行数:7,代码来源:index.php

示例5: main

function main()
{
    download();
    parse();
    sanitize();
    final_html_generation();
}
开发者ID:gonejack,项目名称:phpTextScript,代码行数:7,代码来源:1q84_epub_content_fetching.php

示例6: export_begin

 function export_begin($keys, $type, $count, $filename = '')
 {
     $filename = !empty($filename) ? $filename : $type . '-' . date('YmdHis') . '(' . $count . ')';
     download($filename . '.csv');
     if ($keys) {
         $this->export_rows(array($keys));
     }
 }
开发者ID:noikiy,项目名称:MyShop,代码行数:8,代码来源:io.csv.php

示例7: export_begin

 function export_begin($keys, $type, $count)
 {
     download($type . '-' . date('Ymd') . '(' . $count . ').xls');
     echo '<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style>td{vnd.ms-excel.numberformat:@}</style></head>';
     echo '<table width="100%" border="1">';
     echo '<tr><th filter=all>' . implode('</th><th filter=all>', $keys) . "</th></tr>\r\n";
     flush();
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:8,代码来源:io.xls.php

示例8: download

/**
*   Crawls through user's page and downloads all avaliable images/videos
*/
function download($RCX, $username, $max_id = 0)
{
    $id = '';
    $lastId = '';
    if ($max_id > 0) {
        $id = $max_id;
    }
    $userURL = "https://www.instagram.com/" . $username . "/media/?&max_id=" . $id;
    $ch = curl_init();
    $curl_options = array(CURLOPT_URL => $userURL, CURLOPT_REFERER => "https://www.instagram.com", CURLOPT_USERAGENT => "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)", CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10, CURLOPT_HTTPHEADER => array('Content-type: application/json'), CURLOPT_COOKIEFILE => __DIR__ . "/cookies.txt", CURLOPT_SSL_VERIFYPEER => false);
    curl_setopt_array($ch, $curl_options);
    $response = curl_exec($ch);
    if (empty($response)) {
        die("API returned nothing\r\n");
    }
    curl_close($ch);
    $json = json_decode($response, true);
    if ($json['status'] == "ok" && !empty($json['items'])) {
        // Loop over json, get the filename, URL and timestamp
        foreach ($json['items'] as $data) {
            if ($data['type'] == "video") {
                $imageURL = $data['videos']['standard_resolution']['url'];
                $name = explode("/", $imageURL);
                $name = $name[count($name) - 1];
            } else {
                $urlSplit = explode("/", $data['images']['standard_resolution']['url']);
                $name = $urlSplit[count($urlSplit) - 1];
                // Some images have URLs of different lengths
                // "/s1080x1080/" ensures the image is the largest possible
                if (count($urlSplit) == 6) {
                    $imageURL = $urlSplit[0] . "//" . $urlSplit[2] . "/" . $urlSplit[3] . "/" . $urlSplit[4] . "/" . $urlSplit[5];
                } elseif (count($urlSplit) == 7) {
                    $imageURL = $urlSplit[0] . "//" . $urlSplit[2] . "/" . $urlSplit[3] . "/s1080x1080/" . $urlSplit[5] . "/" . $urlSplit[6];
                } elseif (count($urlSplit) == 8) {
                    $imageURL = $urlSplit[0] . "//" . $urlSplit[2] . "/" . $urlSplit[3] . "/" . $urlSplit[4] . "/s1080x1080/" . $urlSplit[6] . "/" . $urlSplit[7];
                } elseif (count($urlSplit) == 9) {
                    $imageURL = $urlSplit[0] . "//" . $urlSplit[2] . "/" . $urlSplit[3] . "/" . $urlSplit[4] . "/s1080x1080/" . $urlSplit[6] . "/" . $urlSplit[7] . "/" . $urlSplit[8];
                } else {
                    $imageURL = $data['images']['standard_resolution']['url'];
                }
            }
            // Add image to download queue
            $RCX->addRequest($imageURL, null, 'save', ['fileName' => $name, 'created_time' => $data['created_time'], 'username' => $username]);
            // Instagram only shows one page of images at a given time, saves the id of the last image
            $lastId = $data['id'];
        }
    } else {
        die("Invalid username or private account.\r\n");
    }
    // Recurse if more images are avaliable
    if ($json['more_available'] == true) {
        return download($RCX, $username, $lastId);
    } else {
        $RCX->setOptions([array(CURLOPT_REFERER => "http://instagram.com", CURLOPT_USERAGENT => "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)", CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10)]);
        $RCX->execute();
    }
}
开发者ID:ClayF,项目名称:instagram-image-downloader,代码行数:60,代码来源:instagram_dl.php

示例9: updateP5JSEDITOR

function updateP5JSEDITOR($lib_v, $lib_d)
{
    $r = 'https://raw.githubusercontent.com/processing/p5.js-editor/master/';
    download($r . 'package.json', 'package.json');
    $v = getPackageVersion('package.json');
    unlink('package.json');
    $contents = '<?php $version = "' . $lib_v . '"; $date = "' . $lib_d . '"; $p5jseditor_version = "' . $v . '"; ?>';
    file_put_contents('version.php', $contents);
    echo 'updating p5.js editor version to ' . $v;
}
开发者ID:andrewjtimmons,项目名称:p5.js-website,代码行数:10,代码来源:release.php

示例10: process_login

function process_login($Html)
{
    $PostHash = extract_form_hash($Html);
    $PostHash['username'] = 'Gvindelen';
    $PostHash['passwd'] = 'grafdevalery';
    $Html = copy_be($Html, '<form ', '>');
    $Tags = extract_property_values($Html, 'action', "\r\n");
    $Html = download($Tags, 'POST', 'http://www.buker.ru/dostaken.php', $PostHash);
    return $Html;
}
开发者ID:joginvik,项目名称:gvindelen,代码行数:10,代码来源:buker.php

示例11: d

 /**
  * 下载文件
  */
 public function d()
 {
     if (isset($GLOBALS['s']) && !empty($GLOBALS['s'])) {
         $file = decode($GLOBALS['s']);
         if (strpos($file, 'wZ:') !== false) {
             $file = str_replace('wZ:', ATTACHMENT_ROOT, $file);
             //echo $file;
             download($file);
         }
     }
 }
开发者ID:jackycgq,项目名称:wuzhicms,代码行数:14,代码来源:down.php

示例12: licenseDocumentProcess

function licenseDocumentProcess($uid)
{
    // this needs to use REQUEST , so onBeforeDownload plugins can use redirect
    $accepted = mosGetParam($_REQUEST, 'agree', 0);
    $inline = mosGetParam($_REQUEST, 'inline', 0);
    $doc = new DOCMAN_Document($uid);
    if ($accepted) {
        download($doc, $inline);
    } else {
        _returnTo('view_cat', _DML_YOU_MUST, $doc->getData('catid'));
    }
}
开发者ID:allenahner,项目名称:mizzou,代码行数:12,代码来源:download.php

示例13: savePrices

function savePrices()
{
    global $db;
    mysqli_query($db, "TRUNCATE TABLE  `it_prices`");
    global $pricesURL;
    $csv = download($pricesURL);
    $csv = explode("\n", $csv);
    for ($i = 2; $i <= count($csv); $i++) {
        $a = explode(";", $csv[$i]);
        mysqli_query($db, "INSERT INTO `it_prices`(`id`, `type`, `price`, `self`, `date`) VALUES ( \"{$a['0']}\", \"{$a['1']}\", \"{$a['2']}\", " . ($a[3] == 0 ? "false" : "true") . ", \"{$a['4']}\" )") or die(mysqli_error());
    }
}
开发者ID:xXSparkeyy,项目名称:harbour-spritradar,代码行数:12,代码来源:index.php

示例14: checkAmazonSmallImage

/**
 * amazon workaround for 1 pixel transparent images
 */
function checkAmazonSmallImage($url, $ext, $file)
{
    if (preg_match('/^(.+)L(Z{7,}.+)$/', $url, $m)) {
        if (list($width, $height, $type, $attr) = getimagesize($file)) {
            if ($width <= 1) {
                $smallurl = $m[1] . 'M' . $m[2];
                if (cache_file_exists($smallurl, $cache_file, CACHE_IMG, $ext) || download($smallurl, $cache_file)) {
                    copy($cache_file, $file);
                }
            }
        }
    }
}
开发者ID:Boris-de,项目名称:videodb,代码行数:16,代码来源:img.php

示例15: Get_owncloud

function Get_owncloud()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
    $pid = @file_get_contents($pidfile);
    $unix = new unix();
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["VERBOSE"]) {
            echo "Already executed pid {$pid} since {$time}mn\n";
        }
        die;
    }
    $uri = download();
    if ($uri == null) {
        return;
    }
    $curl = new ccurl($uri);
    $curl->NoHTTP_POST = true;
    $cp = $unix->find_program("cp");
    $rm = $unix->find_program("rm");
    progress("Downloading Owncloud package...", 25);
    if (!$curl->GetFile("/root/owncloud.tar.gz")) {
        progress("Failed download owncloud package", 110);
        return;
    }
    if (is_dir("/usr/share/owncloud")) {
        shell_exec("{$rm} -rf /usr/share/owncloud");
    }
    @mkdir("/usr/share/owncloud", 0755, true);
    if (!is_dir("/usr/share/owncloud")) {
        progress("/usr/share/owncloud permission denied", 110);
        @unlink("/root/owncloud.tar.gz");
        return;
    }
    $tar = $unix->find_program("tar");
    progress("Extracting package...", 35);
    shell_exec("{$tar} xf /root/owncloud.tar.gz -C /usr/share/owncloud/");
    @unlink("/root/owncloud.tar.gz");
    if (is_dir("/usr/share/owncloud/owncloud")) {
        shell_exec("{$cp} -rf /usr/share/owncloud/owncloud/* /usr/share/owncloud/");
        shell_exec("{$rm} -rf /usr/share/owncloud/owncloud");
    }
    if (is_file("/usr/share/owncloud/settings/settings.php")) {
        progress("Success...", 100);
        $unix->Process1(true);
        return;
    }
    progress("Failed...", 110);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:51,代码来源:compile-owncloud.php


注:本文中的download函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。