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


PHP process_file函数代码示例

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


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

示例1: run_files

function run_files($file)
{
    if (is_link($file)) {
        return;
    }
    if (is_dir($file . '/.')) {
        $dh = opendir($file);
        $files = array();
        while (false !== ($f = readdir($dh))) {
            if ($f[0] == '.') {
                continue;
            }
            if (is_dir($file . '/' . $f . '/.')) {
                $files[] = $file . '/' . $f;
            } else {
                $ext = strtolower(substr(strrchr($f, '.'), 1));
                if ($ext == 'css' || $ext == 'html' || $ext == 'php' || $ext == 'js') {
                    $files[] = $file . '/' . $f;
                }
            }
        }
        closedir($dh);
        foreach ($files as $f) {
            run_files($f);
        }
    } else {
        process_file($file);
    }
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:29,代码来源:header_link_change.php

示例2: dir_enter

function dir_enter($entry_dir = '/', $depth = 0)
{
    $found = 0;
    # Remove the last trailing slash and void dual writing
    $entry_dir = preg_replace('/\\/$/i', '', $entry_dir);
    $skip_list = array('.', '..');
    if ($dir_handle = opendir($entry_dir)) {
        while (false !== ($filename = readdir($dir_handle))) {
            if (in_array($filename, $skip_list)) {
                continue;
            }
            $full_file_path = "{$entry_dir}/{$filename}";
            if (is_dir($full_file_path)) {
                # Need to loop here inside the directory
                fecho(str_repeat('  ', $depth));
                # depth marker
                #fecho("{$full_file_path}");
                fecho("{$filename}");
                # Recurse through the file
                $function = __FUNCTION__;
                $found += $function($full_file_path, $depth + 1);
            } else {
                #fecho(str_repeat('  ', $depth)); # depth marker
                #fecho("{$full_file_path}");
                #fecho("{$filename}");
                ++$found;
                process_file($full_file_path, $depth);
            }
        }
        closedir($dir_handle);
    }
    return $found;
}
开发者ID:abhay123lp,项目名称:duplicates,代码行数:33,代码来源:inc.dir_enter.php

示例3: watch_dir

/**
 * 监视文件夹
 * @param $host string 服务器地址
 * @param $port int 服务器端口
 * @param $root string 要监视的目录
 * @param $ignore array 忽略的文件
 * @return bool 是否被改变
 */
function watch_dir($host, $port, $id, $root, $ignore)
{
    $socket = null;
    $changed = false;
    $modify_table = load_modify_time();
    if (!is_dir($root)) {
        echo "{$root} not dir\n";
        exit(1);
    }
    $queue = array($root);
    $t = -microtime(true);
    while (!empty($queue)) {
        // echo "queue\n"; var_dump($queue);
        $root_dir = array_shift($queue);
        // echo "enter dir $root_dir\n";
        $d = opendir($root_dir);
        if ($d === false) {
            echo "{$root_dir} not exists\n";
            exit(1);
        }
        while (($f = readdir($d)) !== false) {
            if ($f == '.' || $f == '..') {
                continue;
            }
            if (in_array($f, $ignore)) {
                // echo "skip $f\n";
                continue;
            }
            $filename = "{$root_dir}/{$f}";
            if (is_file($filename)) {
                $filesize = filesize($filename);
                assert($filesize !== false);
                if ($filesize > 100 * 1024 * 1024) {
                    // big than 100M
                    echo "skip {$filename} with size {$filesize}\n";
                } else {
                    list($modify_table, $socket, $changed) = process_file($host, $port, $id, $root, $modify_table, $filename, $socket, $changed);
                }
            } elseif (is_dir($filename)) {
                // echo "add to queue $filename\n";
                $queue[] = "{$filename}";
            }
        }
    }
    $t += microtime(true);
    echo " ({$root} " . intval($t * 1000) . " ms)";
    // echo "ok\n";
    save_modify_time(modify_time());
    if ($socket !== null) {
        end_socket($socket);
    }
    return $changed;
}
开发者ID:noname007,项目名称:file-sync,代码行数:61,代码来源:lib_local.php

示例4: doMpdParse

function doMpdParse($command, &$dirs, $domains)
{
    global $connection, $collection, $mpd_file_model, $array_params;
    global $parse_time;
    if (!$connection) {
        return;
    }
    fputs($connection, $command . "\n");
    $filedata = $mpd_file_model;
    $parts = true;
    if (count($domains) == 0) {
        $domains = null;
    }
    $pstart = microtime(true);
    while (!feof($connection) && $parts) {
        $parts = getline($connection);
        if (is_array($parts)) {
            switch ($parts[0]) {
                case "directory":
                    $dirs[] = trim($parts[1]);
                    break;
                case "Last-Modified":
                    if ($filedata['file'] != null) {
                        // We don't want the Last-Modified stamps of the directories
                        // to be used for the files.
                        $filedata[$parts[0]] = $parts[1];
                    }
                    break;
                case 'file':
                    if ($filedata['file'] != null && (!is_array($domains) || in_array(getDomain($filedata['file']), $domains))) {
                        $parse_time += microtime(true) - $pstart;
                        process_file($filedata);
                        $pstart = microtime(true);
                    }
                    $filedata = $mpd_file_model;
                    // Fall through to default
                // Fall through to default
                default:
                    if (in_array($parts[0], $array_params)) {
                        $filedata[$parts[0]] = array_unique(explode(';', $parts[1]));
                    } else {
                        $filedata[$parts[0]] = explode(';', $parts[1])[0];
                    }
                    break;
            }
        }
    }
    if ($filedata['file'] !== null && (!is_array($domains) || in_array(getDomain($filedata['file']), $domains))) {
        $parse_time += microtime(true) - $pstart;
        process_file($filedata);
    }
}
开发者ID:cyrilix,项目名称:rompr,代码行数:52,代码来源:connection.php

示例5: process_path

function process_path($path)
{
    if (is_dir($path)) {
        //echo "dir: [$path]\n";
        $path = rtrim($path, "\\/") . "/";
        foreach (glob($path . "*", GLOB_ONLYDIR) as $subdir) {
            process_path($subdir);
        }
        foreach (glob($path . "*.class.php") as $file) {
            process_path($file);
        }
    } else {
        process_file($path);
    }
}
开发者ID:laiello,项目名称:pkgmanager,代码行数:15,代码来源:scan_classes.php

示例6: process_directory

function process_directory($path)
{
    $dir = opendir($path);
    while ($file = readdir($dir)) {
        if (substr($file, 0, 1) == '.') {
            continue;
        }
        $filepath = $path . '/' . $file;
        if (is_dir($filepath)) {
            process_directory($filepath);
        } elseif (is_file($filepath)) {
            if (substr($file, -4) == '.php') {
                process_file($filepath);
            }
        } else {
            print "Unknown type: {$filepath}\n";
        }
    }
    closedir($dir);
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:20,代码来源:copyright_updater.php

示例7: run_files

function run_files($file)
{
    if (is_link($file)) {
        return;
    }
    if (is_dir($file . '/.')) {
        $dh = opendir($file);
        $files = array();
        while (false !== ($f = readdir($dh))) {
            if ($f[0] != '.') {
                $files[] = $file . '/' . $f;
            }
        }
        closedir($dh);
        foreach ($files as $f) {
            run_files($f);
        }
    } else {
        process_file($file);
    }
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:21,代码来源:role_fixer.php

示例8: str_replace

    if (!$file_contents) {
        echo "downloading failed\n";
    }
    $file_contents = str_replace("<xhtml:p xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">", htmlspecialchars("<p>"), $file_contents);
    $file_contents = str_replace("</xhtml:p>", htmlspecialchars("</p>"), $file_contents);
    if (!($OUT = fopen($download_cache_path, "w+"))) {
        debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $download_cache_path);
        return;
    }
    fwrite($OUT, $file_contents);
    fclose($OUT);
    if (filesize($download_cache_path)) {
        clearstatcache();
        echo "{$file_name} - " . filesize($download_cache_path) . "<br>\n";
        echo "<hr>Parsing Document {$file_name}<hr>\n";
        process_file($download_cache_path, $url);
        echo "Processed {$file_name}\n";
    }
}
if (!($OUT = fopen($new_resource_path, "w+"))) {
    debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $new_resource_path);
    return;
}
fwrite($OUT, serialize($all_taxa));
fclose($OUT);
shell_exec(PHP_BIN_PATH . dirname(__FILE__) . "/helpers/plazi_step_two.php");
shell_exec("rm -f " . DOC_ROOT . "temp/30.xml");
shell_exec("rm -f " . DOC_ROOT . "temp/downloaded_rdf.rdf");
shell_exec("rm -f " . DOC_ROOT . "temp/plazi.xml");
function process_file($path, $url)
{
开发者ID:eliagbayani,项目名称:maps_test,代码行数:31,代码来源:30.php

示例9: scandir

<?php

echo "go...<br>";
require_once "../_connect.php";
echo "go...<br>";
$dir = 'data/files';
$files = scandir($dir, 0);
print_r($files);
$logname = "data_load_from_file";
foreach ($files as $filename) {
    if (substr($filename, -4) == ".csv") {
        process_file($dir . "/" . $filename);
    } else {
    }
}
// *******************************************************************
// ****  process file  ***********************************************
// *******************************************************************
function process_file($filename)
{
    global $conn;
    echome("Processing file {$filename}", 1);
    $fi2 = file($filename);
    $filepath = $filename;
    $sql = <<<MOUT
load data local infile '{$filepath}'
into table data_in
fields terminated by ","
optionally enclosed by "\\""
lines terminated by "
"
开发者ID:justinwool,项目名称:vortago,代码行数:31,代码来源:cron_loadData.php

示例10: get_directory

function get_directory($dir, $level = 0) {
  $ignore = array( 'cgi-bin', '.', '..' );
  $dh = @opendir($dir);
  while( false !== ( $file = readdir($dh))){
    if( !in_array( $file, $ignore ) ){
      if(is_dir("$dir/$file")) {
        echo "\n$file\n";
        get_directory("$dir/$file", ($level+1));
      }
      else {
        //echo "$spaces $file\n";
        process_file("$dir/$file");
      }
    }
  }

  closedir( $dh );

  if(is_dir_empty($dir) && $dir != "D:/wamp/www/tmp_dir") {
    //print "\n-= Removing $dir =-\n";
    rmdir($dir);

  }

}
开发者ID:ra-ckhar,项目名称:www,代码行数:25,代码来源:storedicom.php

示例11: showmessage

        showmessage('服务器无法创建上传目录');
    }
    //本地上传
    $new_name = $_SC['attachdir'] . './' . $filepath;
    $tmp_name = $FILE['tmp_name'];
    if (@copy($tmp_name, $new_name)) {
        //移动文件
        @unlink($tmp_name);
        //删除POST的临时文件
    } elseif (function_exists('move_uploaded_file') && @move_uploaded_file($tmp_name, $new_name)) {
    } elseif (@rename($tmp_name, $new_name)) {
    } else {
        showmessage('对不起,无法转移临时文件到服务器指定目录。~~~~(>_<)~~~~ ');
    }
    $filedownload = '';
    $result = process_file($new_name, &$filedownload);
    if ($result == 1) {
        showmessage('上传成功,感谢您的邀请!', $_POST[refer], 0);
    } else {
        showmessage('文件存在部分问题,请根据链接地址下载后更新重新提交' . "<a href=" . './plugin/invite/download/' . $filedownload . " style=color:red;" . ">点击下载无效记录</a>");
    }
}
//43
include template("cp_invitefriend");
//读取excel文件的内容
function process_file($filename, &$tempname)
{
    global $_SGLOBAL;
    $isfile = 1;
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('UTF-8');
开发者ID:shiyake,项目名称:php-ihome,代码行数:31,代码来源:cp_invitefriend.php

示例12: process_directory

/**
 * Recursively process a directory, picking regular files and feeding
 * them to process_file().
 *
 * @param string $dir the full path of the directory to process
 * @param string $userfield the prefix_user table field to use to
 *               match picture files to users.
 * @param bool $overwrite overwrite existing picture or not.
 * @param array $results (by reference) accumulated statistics of
 *              users updated and errors.
 *
 * @return nothing
 */
function process_directory($dir, $userfield, $overwrite, &$results)
{
    if (!($handle = opendir($dir))) {
        notify(get_string('uploadpicture_cannotprocessdir', 'admin'));
        return;
    }
    while (false !== ($item = readdir($handle))) {
        if ($item != '.' && $item != '..') {
            if (is_dir($dir . '/' . $item)) {
                process_directory($dir . '/' . $item, $userfield, $overwrite, $results);
            } else {
                if (is_file($dir . '/' . $item)) {
                    $result = process_file($dir . '/' . $item, $userfield, $overwrite);
                    switch ($result) {
                        case PIX_FILE_ERROR:
                            $results['errors']++;
                            break;
                        case PIX_FILE_UPDATED:
                            $results['updated']++;
                            break;
                    }
                }
            }
            // Ignore anything else that is not a directory or a file (e.g.,
            // symbolic links, sockets, pipes, etc.)
        }
    }
    closedir($handle);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:42,代码来源:uploadpicture.php

示例13: basename

     $isfile = 1;
     $filename = basename($_FILES['file']['name']);
     $ext = substr($filename, strpos($filename, '.') + 1);
     if ($ext == "xls" && $_FILES["file"]["size"] < 100000) {
         //检测是否有同名的文件存在
         //if (!file_exists($newname)) {
         //存储在一个地址
         //确定存储地址
         //$newname = getsiteurl().'\upload2\\'.$filename;
         $newname = S_ROOT . './plugin/invite/upload/' . $filename;
         if (move_uploaded_file($_FILES['file']['tmp_name'], $newname)) {
             //重命名文件
             $renamefilename = S_ROOT . './plugin/invite/phpreadexcel/upload/' . date("Y-m-d") . '_upload_' . rand() . '.' . $ext;
             rename($newname, $renamefilename);
             $filedownload = '';
             $r = process_file($renamefilename, &$filedownload);
             //echo "文件已被保存和上传
             if ($r == 1) {
                 showmessage('upload_success');
             } else {
                 //exit(getsiteurl);
                 showmessage('文件存在部分问题,请根据链接地址下载后更新重新提交' . "<a href=" . './plugin/invite/download/' . $filedownload . " style=color:red;" . ">点击下载无效记录</a>");
             }
         } else {
             showmessage('upload_failure');
         }
     } else {
         showmessage('file_limit');
     }
 } else {
     showmessage('no_file_upload');
开发者ID:shiyake,项目名称:php-ihome,代码行数:31,代码来源:cp_invite2.php

示例14: process_cal

 /**
  * Processes the calendar set for the calling Parser object.
  *
  * @access public
  * @alias process_file
  */
 function process_cal()
 {
     process_file($this->cal->filename);
 }
开发者ID:r4mp,项目名称:Foodle,代码行数:10,代码来源:class.Parser.php

示例15: date_default_timezone_set

<?php

include '../util.php';
include '../solver.php';
include '../reader.php';
date_default_timezone_set('Europe/Amsterdam');
$message = null;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_FILES['knowledgebase'])) {
        $message = process_file($_FILES['knowledgebase']);
    } else {
        if (isset($_POST['delete-file'])) {
            $message = delete_file($_POST['delete-file']);
        }
    }
}
function process_file($file)
{
    if ($file['error'] != 0) {
        return "Er is een fout opgetreden bij het uploaden.";
    }
    $reader = new KnowledgeBaseReader();
    $errors = $reader->lint($file['tmp_name']);
    if (!preg_match('/^[a-zA-Z0-9_\\-\\.]+\\.xml$/i', $file['name'])) {
        return "De bestandsnaam bevat karakters die niet goed verwerkt kunnen worden.";
    }
    if (count($errors) > 0) {
        $out = "De volgende fouten zijn gevonden in de knowledge-base:\n<ul>";
        foreach ($errors as $error) {
            $out .= sprintf("\n<li title=\"%s\">%s</li>\n", htmlspecialchars($error->file . ':' . $error->line, ENT_QUOTES, 'utf-8'), $error->message);
        }
开发者ID:Nr90,项目名称:kennissysteem,代码行数:31,代码来源:list.php


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