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


PHP output_file函数代码示例

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


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

示例1: update_data

function update_data($f)
{
    reset_status_cantine();
    $new_f = str_replace(".csv", "_FAAA.csv", $f);
    //echo ($new_f)."<br>";
    $fr = fopen($f, 'r');
    $fw = fopen($new_f, 'w');
    $total = 0;
    $touteslettres = "";
    while (!feof($fr)) {
        $l = fgets($fr);
        $ar_l = explode(";", $l);
        if (is_numeric($ar_l[0])) {
            //echo "processing line ".$l."<br />";
            $cf = $ar_l[5] / 100;
            $debut = mysqldateformat($ar_l[6]);
            $fin = mysqldateformat($ar_l[7]);
            $days = (strtotime($fin) - strtotime($debut)) / 86400;
            $months = round($days / 30);
            $ar_l[8] = "DP";
            $ar_l[9] = $months;
            $ar_l[10] = 1600 * $cf;
            $ar_l[11] = $months * 1600 * $cf;
            $ar_l[12] = 0;
            $ar_l[13] = $ar_l[11];
            $ar_l[14] = 0;
            $ar_l[15] = 0;
            $ar_l[16] = $ar_l[11];
            $total += $ar_l[16];
            $touteslettres = chiffre_en_lettre($total);
            $l = join(";", $ar_l);
            fwrite($fw, $l);
            $cps = $ar_l[1];
            if ($ar_l[5] == "100") {
                $status = 15;
            } else {
                $status = 16;
            }
            update_enfant($cps, $status, $fin);
        } else {
            if (substr($l, 0, 3) == ";;;") {
                //end
                $l = str_replace("Total;;", "Total;{$total};", $l);
                $l = str_replace("(en toutes lettres) :", "(en toutes lettres) : {$touteslettres}", $l);
                fwrite($fw, $l);
            } else {
                //echo "ignoring line ".$l."<br />";
                fwrite($fw, $l);
            }
        }
        unset($ar_l);
    }
    fclose($fr);
    fclose($fw);
    output_file($new_f, substr($new_f, 4), "csv");
}
开发者ID:BGCX067,项目名称:faaa-multifac-svn-to-git,代码行数:56,代码来源:upload_cps_cf.php

示例2: update_data

function update_data($f)
{
    $new_f = str_replace(".txt", "_ssBP.txt", $f);
    //echo ($new_f)."<br>";
    $fr = fopen($f, 'r');
    $fw = fopen($new_f, 'w');
    while (!feof($fr)) {
        $l = fgets($fr);
        $bp = substr($l, 206, 32);
        if (stripos($bp, 'bp') !== false) {
            fwrite($fw, $l);
        }
    }
    fclose($fr);
    fclose($fw);
    output_file($new_f, substr($new_f, 5), "txt");
}
开发者ID:BGCX067,项目名称:faaa-multifac-svn-to-git,代码行数:17,代码来源:upload_rol_ssbp.php

示例3: die

        die('Error - can not open file.');
    }
    die;
}
/*********************************************
			Example of use
**********************************************/
set_time_limit(0);
$report = $_POST['report_type'] . "_" . $_POST['time_frame'];
/************
if($report=="all")
{
$file_path='parental_reports_sample.txt';
}
else if($report=="site")
{
$file_path='parental_reports_sample1.txt';
}
else if($report=="service")
{
$file_path='parental_reports_sample2.txt';
}
else
{
$file_path='parental_reports_sample3.txt';
}
***********/
$file_path = "/var/tmp/parental_reports_" . $report . ".txt";
$file_name = "parental_repotts_" . $report . ".txt";
output_file($file_path, $file_name, 'text/plain');
//output_file("parental_reports_sample.txt","parental_reports_sample.txt","text/plain");
开发者ID:WizzerWorks,项目名称:webui,代码行数:31,代码来源:parental_reports_sample.php

示例4: header

            header("location: ./");
            exit;
        }
        if ($item["pdf"]) {
            // PDF ファイル
            $item["pdf_file"] = Image::getData($item["pdf"]);
        }
        $data["item"] = $item;
        //
        htmltemplate::t_include($item["propaty"]["item_html"], $data);
        exit;
    }
}
if ($act == "output_file") {
    $id = $_REQUEST["id"];
    output_file($id);
}
if ($act == "contact" || $act == "contact_reinput") {
    $id = $_REQUEST["id"];
    $item = get_info($id);
    //
    $data["item"] = $item;
    //
    $mode = $_REQUEST["mode"];
    if ($mode == "form") {
        $form = $_REQUEST;
        $form["title"] = $item["title"];
        $data["form"] = $form;
        // エラーチェック
        $msg = array();
        if (!$form["name"]) {
开发者ID:kaz1114,项目名称:sagamicc.org,代码行数:31,代码来源:index.php

示例5: fseek

        if (isset($_SERVER['HTTP_RANGE'])) {
            fseek($file, $range);
        }
        while (!feof($file) && !connection_aborted() && $bytes_send < $new_length) {
            $buffer = fread($file, $chunksize);
            echo $buffer;
            flush();
            $bytes_send += strlen($buffer);
        }
        fclose($file);
    } else {
        //If no permissiion
        die('Error - can not open file.');
    }
    //die
    die;
}
//Set the time out
set_time_limit(0);
$files = new Files();
$fileid = $_REQUEST['fileid'];
$data = $files->getFileData($fileid);
//path to the file
$file_path = $data->filepath;
$filename = $data->filename;
$createdate = $data->createdate;
$date = date_create($createdate);
$fileDate = date_format($date, 'd-m-Y');
//Call the download function with file path,file name and file type
output_file($file_path . '/' . $fileDate . '/' . $fileid . '_' . $filename, '' . $fileid . '_' . $filename . '');
开发者ID:pritam-hajare,项目名称:IGI,代码行数:30,代码来源:download.php

示例6: intval

<?php

include "db_functions.inc.php";
include "config.inc.php";
include "outputfile.php";
$get_id = intval($_GET['id']);
$select_link = yasDB_select("SELECT `id`, `file` FROM `downgames` WHERE `id` = {$get_id}");
if ($select_link->num_rows == 1) {
    $result = $select_link->fetch_array(MYSQLI_ASSOC);
    yasDB_update("UPDATE `downgames` SET `downloadtimes` = `downloadtimes` + 1 WHERE id = {$result['id']}");
    output_file($result['file'], basename($result['file']));
}
$select_link->close();
开发者ID:royalswe,项目名称:yas26,代码行数:13,代码来源:link_download.php

示例7: die

            } else {
                //If no permissiion
                die('Error - can not open file.');
            }
            //die
            die;
        }
        //Set the time out
        set_time_limit(0);
        //path to the file
        $filename = $row['url'];
        /*$file_path='files/'.$_REQUEST['filename'];*/
        $file_path = 'files/' . $filename;
        //Call the download function with file path,file name and file type
        /* output_file($file_path, ''.$_REQUEST['filename'].'', 'text/plain');*/
        output_file($file_path, $filename, 'video/mp4');
        /*
        //This application is developed by www.webinfopedia.com
        //visit www.webinfopedia.com for PHP,Mysql,html5 and Designing tutorials for FREE!!!
        */
    } else {
        echo 'You have already downloaded this content!';
    }
} else {
    echo 'Your token is invalid!';
}
?>



开发者ID:ReConcepts,项目名称:dosika,代码行数:27,代码来源:downloads.php

示例8: gps_to_epoch

$start_epoch = gps_to_epoch($ride_data_array[ride_date]);
if ($target_array[object] === 'segment') {
    //segments have no time stamps
    $stop_at = count($stream_data->latlng) - 1;
} else {
    //stationary rides have no coordinates
    $stop_at = count($stream_data->time) - 1;
}
//TURNING THE CRANK
for ($i = 0; $i <= $stop_at; $i++) {
    $seconds_time = $stream_data->time[$i];
    $timestamp = gps_date($start_epoch + $seconds_time);
    $altitude = $stream_data->altitude[$i];
    $cadence = $stream_data->cadence[$i];
    $distance = $stream_data->distance[$i];
    $latlng = $stream_data->latlng[$i];
    $heartrate = $stream_data->heartrate[$i];
    $temp = $stream_data->temp[$i];
    if ($stream_data->watts[0] !== FALSE) {
        $watts = $stream_data->watts[$i];
    } else {
        $watts = $stream_data->watts_calc[$i];
    }
    $loop_result = array('time' => $timestamp, 'altitude' => $altitude, 'cadence' => $cadence, 'distance' => $distance, 'lat' => $latlng[0], 'lng' => $latlng[1], 'heartrate' => $heartrate, 'temp' => $temp, 'watts' => $watts);
    $data_line = datapoint_format($file_type, $loop_result);
    $trackpoints = $trackpoints . $data_line;
}
$footer = add_footer($file_type);
$contents = $header . $trackpoints . $footer;
$new_name = output_file($file_type, $target_array[id], $contents);
echo 'Congratulations - <a href="' . $target_array[id] . '.' . strtolower($file_type) . '">your file export</a> is ready.';
开发者ID:rpassmore,项目名称:strava-export,代码行数:31,代码来源:export.php

示例9: fseek

    /* output the file itself */
    $chunksize = 1 * (1024 * 1024);
    //you may want to change this
    $bytes_send = 0;
    if ($file = fopen($file, 'r')) {
        if (isset($_SERVER['HTTP_RANGE'])) {
            fseek($file, $range);
        }
        while (!feof($file) && !connection_aborted() && $bytes_send < $new_length) {
            $buffer = fread($file, $chunksize);
            print $buffer;
            //echo($buffer); // is also possible
            flush();
            $bytes_send += strlen($buffer);
        }
        fclose($file);
    } else {
        die('Error - can not open file.');
    }
    die;
}
/* 
Make sure script execution doesn't time out.
Set maximum execution time in seconds (0 means no limit).
*/
set_time_limit(0);
switch ($_GET["file"]) {
    case "client":
        output_file("../../../pos_client/client.zip", 'client.zip', 'application/zip');
        break;
}
开发者ID:kailIII,项目名称:pos-erp,代码行数:31,代码来源:dl.php

示例10: alert

    if (!$attachment) {
        alert("文件不存在");
        exit;
    }
    $dt = $attachment['dt'];
    $file_dir = $cfg['AttachmentDir'] . date("Y-m", strtotime($attachment['dt'])) . "/";
    //if (!file_exists(Server_MapPath($file_dir.$attachment['filename']))) {
    //	$file_dir=getFileType($attachment['mime']).date("Y-m",strtotime($attachment['dt']))."/";
    //}
    //if (!file_exists(Server_MapPath($file_dir.$attachment['filename']))) {
    //	$file_dir=$cfg['_AttachmentDir'].date("Y-m",strtotime($attachment['dt']))."/";
    //}
    if (strlen(trim($attachment['filename'])) != 0) {
        output_file($cmd, $attachment['filename'], $file_dir, $attachment['formername'], $attachment['mime_type']);
    } else {
        output_file($cmd, $attachment['filename'], $file_dir, $attachment['formername']);
    }
}
function output_file($cmd, $file_name, $file_dir, $formername, $mime = 'application/octet-stream')
{
    $path = $file_dir . $file_name;
    if (!file_exists($path)) {
        echo "文件不存在";
        exit;
    } else {
        $file = fopen($path, "r");
        $filesize = filesize($path);
        Header("Content-type: {$mime}");
        Header("Accept-Ranges: bytes");
        Header("Accept-Length: " . $filesize);
        if ($cmd == "download") {
开发者ID:BGCX261,项目名称:zhishuicms-svn-to-git,代码行数:31,代码来源:file.php

示例11: fseek

            fseek($Source_File, $range);
        }
        while (!feof($Source_File) && !connection_aborted() && $bytes_send < $new_length) {
            $buffer = fread($Source_File, $chunksize);
            print $buffer;
            //echo($buffer); // is also possible
            flush();
            $bytes_send += strlen($buffer);
        }
        fclose($Source_File);
    } else {
        die('Error - can not open file.');
    }
    die;
}
$base_id = $_GET['base_id'];
$id = $_GET['id'];
try {
    if (!$base_id || !$id) {
        throw new Exception('Wrong Parameter');
    }
    $highResFile = dirname(__FILE__) . '/files/' . $base_id . '/boxed/' . $id;
    $thumbFile = dirname(__FILE__) . '/files/' . $base_id . '/boxed/thumbnail/' . $id;
    if (!is_file($highResFile) || !is_file($thumbFile)) {
        throw new Exception('File Not Found');
    }
    output_file($highResFile, $id);
} catch (Exception $e) {
    header('Location: 404.html');
    exit;
}
开发者ID:pentatonicfunk,项目名称:boxed-image,代码行数:31,代码来源:download.php

示例12: writetocsv

function writetocsv($ids_cantine, $ids_etal, $ids_amarrage_clients, $ids_amarrage_mandataires)
{
    $fw = fopen('extract/impayes.csv', 'w');
    if (strlen($ids_cantine) > 0) {
        $ar_cantine_details = get_details_cantine($ids_cantine, 'factures_cantine');
    }
    if (strlen($ids_etal) > 0) {
        $ar_etal_details = get_details_mandataire($ids_etal, 'factures_etal');
    }
    //print ($ids_amarrage_clients);
    if (strlen($ids_amarrage_clients) > 0) {
        $ar_amarrage_clients_details = get_details_client($ids_amarrage_clients, 'factures_amarrage');
    }
    if (strlen($ids_amarrage_mandataires) > 0) {
        $ar_amarrage_mandataires_details = get_details_mandataire($ids_amarrage_mandataires, 'factures_amarrage');
    }
    fwrite($fw, "type;communeid;datefacture;montant;restearegler;periode/obs;nom;prenom;telephone;telephone2;bp;cp;ville;commune;rib;obs;enfantnom;enfantprenom;ecole;classe;\n");
    $ar_types_clients = array("ar_cantine_details", "ar_amarrage_clients_details");
    $ar_types_mandataires = array("ar_etal_details", "ar_amarrage_mandataires_details");
    foreach ($ar_types_clients as &$type) {
        foreach (${$type} as &$ar) {
            fwrite($fw, $ar["0"] . ";");
            fwrite($fw, $ar["communeid"] . ";");
            fwrite($fw, $ar["datefacture"] . ";");
            fwrite($fw, $ar["montantfcp"] . ";");
            fwrite($fw, $ar["restearegler"] . ";");
            fwrite($fw, html_entity_decode($ar['obs'] . ";", ENT_QUOTES, "ISO-8859-1"));
            fwrite($fw, $ar["clientnom"] . ";");
            fwrite($fw, $ar["clientprenom"] . ";");
            fwrite($fw, $ar["clienttelephone"] . ";");
            fwrite($fw, $ar["clientfax"] . ";");
            fwrite($fw, $ar["clientbp"] . ";");
            fwrite($fw, $ar["clientcp"] . ";");
            fwrite($fw, $ar["clientville"] . ";");
            fwrite($fw, $ar["clientcommune"] . ";");
            fwrite($fw, $ar["clientrib"] . ";");
            $clientobs = preg_replace("/\r\n/", ' ', $ar["clientobs"]);
            fwrite($fw, $clientobs . ";");
            if ($type == "ar_cantine_details") {
                fwrite($fw, $ar["enfantnom"] . ";");
                fwrite($fw, $ar["enfantprenom"] . ";");
                fwrite($fw, $ar["nomecole"] . ";");
                fwrite($fw, $ar["classe"] . ";");
            }
            fwrite($fw, "\n");
        }
    }
    foreach ($ar_types_mandataires as &$type) {
        foreach (${$type} as &$ar) {
            fwrite($fw, $ar["0"] . ";");
            fwrite($fw, $ar["communeid"] . ";");
            fwrite($fw, $ar["datefacture"] . ";");
            fwrite($fw, $ar["montantfcp"] . ";");
            fwrite($fw, $ar["restearegler"] . ";");
            fwrite($fw, html_entity_decode($ar['obs'] . ";", ENT_QUOTES, "ISO-8859-1"));
            fwrite($fw, $ar["mandatairenom"] . ";");
            fwrite($fw, $ar["mandataireprenom"] . ";");
            fwrite($fw, $ar["mandatairetelephone"] . ";");
            fwrite($fw, $ar["mandatairetelephone2"] . ";");
            fwrite($fw, $ar["mandatairebp"] . ";");
            fwrite($fw, $ar["mandatairecp"] . ";");
            fwrite($fw, $ar["mandataireville"] . ";");
            fwrite($fw, $ar["mandatairecommune"] . ";");
            fwrite($fw, $ar["mandatairerib"] . ";");
            $mandataireobs = preg_replace("/\r\n/", ' ', $ar["mandataireobs"]);
            fwrite($fw, $mandataireobs . ";");
            fwrite($fw, "\n");
        }
    }
    fclose($fw);
    output_file('extract/impayes.csv', 'impayes.csv', 'csv');
}
开发者ID:BGCX067,项目名称:faaa-multifac-svn-to-git,代码行数:72,代码来源:extract_impayes.php

示例13: output_file

<?php

include_once '../includes/common_functions.php';
$_date = $_SESSION['selected_value'];
$provid = $_SESSION['provider']['serviceprovider_id'];
$file = $_SESSION['csvfile'];
output_file($file, 'techmatcherdata.csv', 'application/csv');
开发者ID:nkpajsmith,项目名称:nealsgit2,代码行数:7,代码来源:downloadcsv.php

示例14: set_time_limit

                }
                //die
                die;
            }
            //Set the time out
            set_time_limit(0);
            //path to the file
            //$filename = $row_d['url'];
            /*$file_path='files/'.$_REQUEST['filename'];*/
            //$file_path='files/'.$filename;
            $filename = $sessionx;
            //$filename = 'The Best.mp4';
            $file_path = 'files/' . $filename;
            //Call the download function with file path,file name and file type
            /* output_file($file_path, ''.$_REQUEST['filename'].'', 'text/plain');*/
            output_file($file_path, $filename, 'audio/mp3');
            echo 'Your download is starting in a second...';
            // } else { echo 'Download not found!'; }
        } else {
            echo 'This token has already been used! You cannot Download this file.<br/>' . $_SESSION['url'];
        }
    } else {
        //             $sessionxx = 1;
        //             var_dump($_SESSION);
        echo 'This token does not exist!<br/>';
    }
    mssql_free_result($token_check_s);
}
/* 
//To store it
foreach ($_REQUEST['url_i'] as $key=>$url_k) {
开发者ID:ReConcepts,项目名称:dosika,代码行数:31,代码来源:m_process.php

示例15: output_file

function output_file($file_item, $current_path, $type)
{
    global $ignore_files, $template_exts, $total_reduce_size;
    if ($current_path !== '') {
        foreach ((array) $file_item['file'] as $file_name => $file_info) {
            if (false === strpos($current_path, 'views') && $file_name[0] === '_' || $file_name[0] == '.') {
                continue;
            }
            if (in_array($file_name, $ignore_files)) {
                continue;
            }
            $file_path = $current_path . '/' . $file_name;
            $result = true;
            $file_skiped = false;
            $ext = get_ext($file_name);
            if ('all' != $type && $ext != $type) {
                continue;
            }
            if ($ext == 'css') {
                if (strpos($file_name, 'min.') === 0) {
                    $result = compress_css($file_path);
                } else {
                    $file_skiped = true;
                }
            } elseif ($ext == 'js') {
                if (strpos($file_name, 'min.') === 0) {
                    $result = compress_js($file_path);
                } else {
                    $file_skiped = true;
                }
            } elseif ($ext == 'png') {
                compress_png($file_path);
            } elseif (in_array($ext, $template_exts)) {
                compress_template($file_path);
            } else {
                copy(ROOT_PATH . $file_path, OUTPUT_DIR . $file_path);
            }
            $file_size = 0;
            if ($file_skiped === false) {
                if (file_exists(OUTPUT_DIR . $file_path)) {
                    $file_size = filesize(OUTPUT_DIR . $file_path);
                    $total_reduce_size += $file_info['infor']['file_size'] - $file_size;
                    if ($file_size <= 0) {
                        $file_size = 'b style="color:#ff0000">' . $file_size . '</b>';
                    } else {
                        $file_size = human_file_size($file_size);
                    }
                } else {
                    $result = false;
                }
            }
            if (false === $result) {
                echo '<p style="color:#ff0000;font-weight:bold">' . $file_path . ' Error</p>';
            } else {
                if ($file_skiped === false) {
                    echo $file_path . ' <b style="color:#1EBC16">OK</b> <span style="color:#888">(' . human_file_size($file_info['infor']['file_size']) . ' → ' . $file_size . ')</span><br />';
                } else {
                    echo '<span style="color:#aaa">' . $file_path . ' <b>Skiped</b></span><br />';
                }
            }
        }
    }
    foreach ((array) $file_item['dir'] as $dir_name => $dir) {
        if ($dir_name[0] === '_' || $dir_name[0] == '.') {
            continue;
        }
        if (in_array($dir_name, $ignore_files)) {
            continue;
        }
        $dir_path = $current_path . '/' . $dir_name;
        echo '<h2>' . $dir_path . '</h2>';
        make_dir($dir_path, OUTPUT_DIR);
        output_file($dir, $dir_path, $type);
    }
}
开发者ID:duanshuyong0,项目名称:Murloc,代码行数:75,代码来源:output.php


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