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


PHP FileManager::read方法代码示例

本文整理汇总了PHP中FileManager::read方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::read方法的具体用法?PHP FileManager::read怎么用?PHP FileManager::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileManager的用法示例。


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

示例1: testReadWriteMkDirWithRemove

 public function testReadWriteMkDirWithRemove()
 {
     $content = 'test';
     $path = __DIR__ . '/test/';
     $filePath = $path . 'test.txt';
     $this->manager->write($filePath, $content);
     $this->assertEquals($content, $this->manager->read($filePath));
     $this->manager->remove($path);
     $this->assertEquals(false, $this->manager->exists($path));
 }
开发者ID:samsonframework,项目名称:localfilemanager,代码行数:10,代码来源:LocalFileManagerTest.php

示例2: load

 public static function load($key, $ttl = "no_ttl")
 {
     if ($key != "config") {
         $config = new Config();
         if ($config->get("cache.active") != 1) {
             // Cache function deactivated
             return null;
         }
     }
     // Create file name as hash from given key
     $filename = md5($key);
     $path = __DIR__ . self::$cache_root . $filename;
     if (is_file($path)) {
         if ($ttl == "no_ttl" || time() < filemtime($path) + (int) $ttl) {
             // Cache file found and valid
             $file = new FileManager($path);
             $cache = unserialize($file->read());
             return $cache;
         }
         // Cache file outdated -> delete cache file
         $file = new FileManager($path);
         $file->delete();
         return null;
     }
     // no cache file found!
     return null;
 }
开发者ID:julianburr,项目名称:project-nutmouse,代码行数:27,代码来源:Cache.php

示例3: date_default_timezone_set

<?php

require '../classes/AutoLoad.php';
date_default_timezone_set('Europe/Madrid');
$mysql = new mysqli(Constan::SERVER, Constan::DBUSER, Constan::DBPASSWORD);
$res = $mysql->query(FileManager::read('sql/sql.sql'));
$mysql->change_user(Constan::DBUSER, Constan::DBPASSWORD, Constan::DATABASE);
$ms = scandir('../modules');
foreach ($ms as $key => $value) {
    if ($value !== '.' && $value !== '..' && $value !== 'index.php') {
        if (is_dir('../modules/' . $value)) {
            $files = scandir('../modules/' . $value . '/sql');
            foreach ($files as $file) {
                if ($file !== '.' && $file !== '..') {
                    $mysql->query(FileManager::read('../modules/' . $value . '/sql/' . $file));
                }
            }
        }
    }
}
$mysql->close();
header('Location:../modules/');
开发者ID:developdms,项目名称:Practica-5,代码行数:22,代码来源:loadmodules.php

示例4: process_adding

 /**
  * Diese Methode verarbeitet das Hinzufuegen eines neuen Empfaengers zum Newslettersystem.
  * Dabei bedient sie sich der Methoden der Klasse NewsletterForm aus dem
  * Frontend.
  * @return String evlt. anfallende Fehlermeldungen oder die Erfolgsmeldung
  */
 protected function process_adding()
 {
     $error = "";
     $rueckgabe = "";
     if (isset($_GET['sendit'])) {
         $error = $this->nl_form->checkInput();
         if (strlen($error) == 0) {
             $rueckgabe = $this->nl_form->subscribe();
         } else {
             $rueckgabe = $error;
         }
     }
     if (isset($_GET['uploadit'])) {
         if (strlen($_FILES['uploadedfile']['name']) == 0) {
             $rueckgabe = $this->text->get_text("form_input_error_nofile") . "<br>\n";
         } else {
             $dateiname = ROOT_PATH . "uploaded/" . $_FILES['uploadedfile']['name'];
             if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $dateiname)) {
                 $endung = substr($dateiname, -3, 3);
                 if ($endung == "txt" || $endung == "csv") {
                     $fm = new FileManager($dateiname);
                     $anzahl = $fm->read();
                     if ($endung == "txt") {
                         $start = 0;
                     } else {
                         $start = 1;
                     }
                     $sql1 = "INSERT INTO " . PREFIX . "newsletter SET email=:email, name=:name," . " anrede=:anrede, aktiv=1, createdAt=:createdAt, updatedAt=:updatedAt;";
                     $stmt1 = $this->db->prepare($sql1);
                     for ($i = $start; $i < $anzahl; $i++) {
                         if ($endung == "txt") {
                             $email = $fm->get_row($i);
                             $name = "";
                             $anrede = "";
                         } else {
                             $email = $fm->get_column($i, 0);
                             $name = $fm->get_column($i, 2);
                             $anrede = $fm->get_column($i, 1);
                         }
                         // add user
                         $this->db->execute($stmt1, array("name" => $name, "anrede" => $anrede, "email" => strip_tags(strtolower(trim($email))), "createdAt" => date("Y-m-d H:i:s"), "updatedAt" => date("Y-m-d H:i:s")));
                     }
                     $rueckgabe = $this->text->get_text("newsletter_subscription_success");
                 } else {
                     $rueckgabe = $this->text->get_text("form_input_error_wrongfile") . "<br>\n";
                 }
                 unlink($dateiname);
             } else {
                 $rueckgabe = "Failed";
             }
         }
     }
     return $rueckgabe;
 }
开发者ID:ReichardtIT,项目名称:open-letters-newsletter,代码行数:60,代码来源:newsletter_usermanagement.class.php

示例5: date_default_timezone_set

<?php

require '../classes/AutoLoad.php';
date_default_timezone_set('Europe/Madrid');
$mysql = new mysqli(Constan::SERVER, Constan::DBUSER, Constan::DBPASSWORD);
$res = $mysql->query(FileManager::read('sql/sql.sql'));
if ($res == 1 || $res != 1) {
    $ms = scandir('../modules');
    $mysql = new mysqli(Constan::SERVER, Constan::DBUSER, Constan::DBPASSWORD, Constan::DATABASE);
    foreach ($ms as $key => $value) {
        if ($value !== '.' && $value !== '..') {
            if (is_dir('../modules/' . $value)) {
                $res = $mysql->query(FileManager::read('../modules/' . $value . '/sql/table.sql'));
                $mysql->query(FileManager::read('../modules/' . $value . '/sql/user.sql'));
            }
        }
    }
}
header('Location:../modules/users/login.php');
开发者ID:developdms,项目名称:Practica-4,代码行数:19,代码来源:loadmodules.php

示例6: Db

 */
define("ROOT_PATH", "./");
require_once ROOT_PATH . "config/config.inc.php";
require_once ROOT_PATH . "framework/db.class.php";
require_once "./framework/filemanager.class.php";
$db = new Db();
//
if (!is_array($_GET) || !array_key_exists("execute", $_GET)) {
    echo "Zum Eintragen in die Db das Skript mit mailaddressimport.php?execute aufrufen!<br>\n";
} else {
    echo "Bedeutung: <ul><li>. bedeutet erfolgreichen Eintrag einer E-Mailadresse";
    echo "</li><li>- bedeutet Ablehnung einer E-Mailadresse weil sie bereits eingetragen ist";
    echo "</li></ul>";
}
$fm = new FileManager("./addresses.txt");
$anzahl = $fm->read();
echo "Es wurden " . $anzahl . " Zeilen aus der Datei gelesen!<br>\n";
echo "************************************************************************************<br>\n";
$unlesbar = 0;
$duplikate = 0;
$empty_lines = 0;
for ($i = 0; $i < $anzahl; $i++) {
    $candidate = $fm->get_row($i);
    // Zeile bereinigen
    $candidate = strip_tags($candidate);
    $candidate = strtolower($candidate);
    $candidate = trim($candidate);
    // oeffnende und schliessende Klassern entfernen
    if (substr($candidate, 0, 1) == "(") {
        $candidate = substr($candidate, 1, strlen($candidate) - 1);
    }
开发者ID:ReichardtIT,项目名称:open-letters-newsletter,代码行数:31,代码来源:mailaddressimport.php


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