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


PHP LoadFile函数代码示例

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


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

示例1: LoadZipOrDir

function LoadZipOrDir($dbi, $zip_or_dir)
{
    global $LANG, $genericpages;
    $type = filetype($zip_or_dir);
    if ($type == 'file') {
        $zip = new ZipReader($zip_or_dir);
        while (list($fn, $data, $attrib) = $zip->readFile()) {
            LoadFile($dbi, $fn, $data, $attrib['mtime']);
        }
    } else {
        if ($type == 'dir') {
            $handle = opendir($dir = $zip_or_dir);
            // load default pages
            while ($fn = readdir($handle)) {
                if ($fn[0] == '.' || filetype("{$dir}/{$fn}") != 'file') {
                    continue;
                }
                $stat = stat("{$dir}/{$fn}");
                $mtime = $stat[9];
                LoadFile($dbi, $fn, implode("", file("{$dir}/{$fn}")), $mtime);
            }
            closedir($handle);
            if ($LANG != "C") {
                // if language is not default, then insert
                // generic pages from the English ./pgsrc
                reset($genericpages);
                $dir = DEFAULT_WIKI_PGSRC;
                while (list(, $fn) = each($genericpages)) {
                    LoadFile($dbi, $fn, implode("", file("{$dir}/{$fn}")), $mtime);
                }
            }
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:oralux,代码行数:34,代码来源:setupwiki.php

示例2: ParseSmileyFile

function ParseSmileyFile($strFileName)
{
    // Chargement du fichier des smileys
    $strContent = LoadFile($strFileName);
    // Les smileys sont traités au niveau HTML, il faut donc convertir
    // les caractères spéciaux éventuels
    $strContent = htmlspecialchars($strContent);
    // On va parser les lignes une par une
    $astrLines = explode("\n", $strContent);
    $aVars = array();
    foreach ($astrLines as $strLine) {
        // Commentaires
        if (substr($strLine, 0, 1) == ';') {
            continue;
        }
        $nMiddle = strpos($strLine, '=');
        if ($nMiddle) {
            $strName = trim(substr($strLine, 0, $nMiddle));
            $strValue = trim(substr($strLine, $nMiddle + 1));
            if ($strValue == 'true') {
                $strValue = true;
            }
            if ($strValue == 'false') {
                $strValue = false;
            }
            $aVars[$strValue] = $strName;
        }
    }
    return $aVars;
}
开发者ID:BackupTheBerlios,项目名称:chuwiki-svn,代码行数:30,代码来源:smiley-replacer.php

示例3: LoadView

function LoadView($name, $company_id)
{
    global $view_base_path;
    $view_data = array();
    $view_data['company_id'] = $company_id;
    $view_info = array();
    ArrayAppend($view_info, 'css', LoadFile(VIEW_BASE_PATH . "{$name}_view.css", $view_data));
    ArrayAppend($view_info, 'js', LoadFile(VIEW_BASE_PATH . "{$name}_view.js", $view_data));
    ArrayAppend($view_info, 'html', LoadFile(VIEW_BASE_PATH . "{$name}_view.html", $view_data));
    return $view_info;
}
开发者ID:guille-phillips,项目名称:phpprojects,代码行数:11,代码来源:view_helper.php

示例4: admin

 /**
 * BackEnd
 *
 * Module backend
 *
 * @access public
 */
 function admin(&$out)
 {
     if (isset($this->data_source) && !$_GET['data_source'] && !$_POST['data_source']) {
         $out['SET_DATASOURCE'] = 1;
     }
     $this->getConfig();
     $out['API_URL'] = $this->config['API_URL'];
     if (!$out['API_URL']) {
         $out['API_URL'] = 'localhost';
     }
     $out['API_PORT'] = $this->config['API_PORT'];
     if (!$out['API_PORT']) {
         $out['API_PORT'] = '6720';
     }
     $out['API_ENABLE'] = (int) $this->config['API_ENABLE'];
     if ($this->view_mode == 'bus_monitor') {
         global $ajax;
         if ($ajax) {
             echo nl2br(LoadFile(ROOT . 'cached/knx_monitor.txt'));
             exit;
         }
     }
     if ($this->view_mode == 'update_settings') {
         global $api_url;
         global $api_port;
         global $api_enable;
         $this->config['API_URL'] = $api_url;
         $this->config['API_PORT'] = $api_port;
         $old_status = $this->config['API_ENABLE'];
         $this->config['API_ENABLE'] = (int) $api_enable;
         if ($this->config['API_ENABLE'] != $old_status) {
             SaveFile(ROOT . 'reboot');
         }
         $this->saveConfig();
         $this->redirect("?");
     }
     if ($this->data_source == 'knxdevices' || $this->data_source == '') {
         if ($this->view_mode == '' || $this->view_mode == 'search_knxdevices') {
             $this->search_knxdevices($out);
             $out['API_STATUS'] = $this->connect();
         }
         if ($this->view_mode == 'edit_knxdevices') {
             $this->edit_knxdevices($out, $this->id);
         }
         if ($this->view_mode == 'delete_knxdevices') {
             $this->delete_knxdevices($this->id);
             $this->redirect("?data_source=knxdevices");
         }
     }
     if (isset($this->data_source) && !$_GET['data_source'] && !$_POST['data_source']) {
         $out['SET_DATASOURCE'] = 1;
     }
     if ($this->data_source == 'knxproperties') {
         if ($this->view_mode == '' || $this->view_mode == 'search_knxproperties') {
             $this->search_knxproperties($out);
         }
     }
 }
开发者ID:Andrew-Shtein,项目名称:majordomo,代码行数:65,代码来源:knxdevices.class.php

示例5: removeFromList

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function removeFromList($id)
 {
     $product = SQLSelectOne("SELECT * FROM products WHERE ID='" . (int) $id . "'");
     if ($product['ID']) {
         SQLExec("DELETE FROM shopping_list_items WHERE PRODUCT_ID='" . (int) $id . "'");
         if (defined('DROPBOX_SHOPPING_LIST')) {
             $data = LoadFile(DROPBOX_SHOPPING_LIST);
             $data = str_replace("\r", '', $data);
             $lines = explode("\n", $data);
             $total = count($lines);
             $found = 0;
             $res_lines = array();
             for ($i = 0; $i < $total; $i++) {
                 if (is_integer(strpos($lines[$i], $product['TITLE']))) {
                     $found = 1;
                 } else {
                     $res_lines[] = $lines[$i];
                 }
             }
             if ($found) {
                 $data = implode("\n", $res_lines);
                 SaveFile(DROPBOX_SHOPPING_LIST, $data);
             }
         }
     }
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:33,代码来源:app_products.class.php

示例6: cached

 function cached($content) {
  $h=md5($content);
  $filename=ROOT.'cached/'.$this->name.'_'.$h.'.txt';
  $cache_expire=15*60; // 15 minutes cache expiration time

  if (file_exists($filename)) {
   if ((time()-filemtime($filename))<=$cache_expire) {
    $cached_result=LoadFile($filename);
   } else {
    unlink($filename);
   }
  }

  if ($cached_result=='') {
   $p=new jTemplate(DIR_TEMPLATES.'null.html', $this->data, $this);
   $cached_result=$p->parse($content, $this->data, DIR_TEMPLATES);
   SaveFile($filename, $cached_result);
  }

  return $cached_result;

 }
开发者ID:novozhenets,项目名称:majordomo,代码行数:22,代码来源:module.class.php

示例7: LoadPostFile

function LoadPostFile(&$request)
{
    $upload = $request->getUploadedFile('file');
    if (!$upload) {
        $request->finish(_("No uploaded file to upload?"));
    }
    // FIXME: more concise message
    // Dump http headers.
    StartLoadDump($request, sprintf(_("Uploading %s"), $upload->getName()));
    echo "<dl>\n";
    $fd = $upload->open();
    if (IsZipFile($fd)) {
        LoadZip($request, $fd, false, array(_("RecentChanges")));
    } else {
        LoadFile($request, $upload->getName(), $upload->getContents());
    }
    echo "</dl>\n";
    EndLoadDump($request);
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:19,代码来源:loadsave.php

示例8: import_classes

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function import_classes(&$out)
 {
     global $file;
     global $overwrite;
     global $only_classes;
     $data = LoadFile($file);
     $records = unserialize($data);
     if (is_array($records)) {
         $total = count($records);
         for ($i = 0; $i < $total; $i++) {
             $old_class = SQLSelectOne("SELECT ID FROM classes WHERE TITLE LIKE '" . DBSafe($records[$i]['TITLE']) . "'");
             $total_o = 0;
             if ($old_class['ID']) {
                 $old_objects = SQLSelect("SELECT * FROM objects WHERE CLASS_ID='" . $old_class['ID'] . "'");
                 $total_o = count($old_objects);
                 for ($io = 0; $io < $total_o; $io++) {
                     $old_objects[$io]['CLASS_ID'] = 0;
                     SQLUpdate('objects', $old_objects[$io]);
                 }
                 if ($overwrite) {
                     $this->delete_classes($old_class['ID']);
                     $records[$i]['ID'] = $old_class['ID'];
                 } else {
                     $records[$i]['TITLE'] = $records[$i]['TITLE'] . rand(0, 500);
                 }
             }
             $objects = $records[$i]['OBJECTS'];
             unset($records[$i]['OBJECTS']);
             $methods = $records[$i]['METHODS'];
             unset($records[$i]['METHODS']);
             $properties = $records[$i]['PROPERTIES'];
             unset($records[$i]['PROPERTIES']);
             $records[$i]['ID'] = SQLInsert('classes', $records[$i]);
             if ($total_o) {
                 for ($io = 0; $io < $total_o; $io++) {
                     $old_objects[$io]['CLASS_ID'] = $records[$i]['ID'];
                     SQLUpdate('objects', $old_objects[$io]);
                 }
             }
             if (is_array($properties)) {
                 $total_p = count($properties);
                 for ($p = 0; $p < $total_p; $p++) {
                     $properties[$p]['CLASS_ID'] = $records[$i]['ID'];
                     $properties[$p]['ID'] = SQLInsert('properties', $properties[$p]);
                 }
             }
             if (is_array($methods)) {
                 $total_m = count($methods);
                 for ($m = 0; $m < $total_m; $m++) {
                     $methods[$m]['CLASS_ID'] = $records[$i]['ID'];
                     $methods[$m]['ID'] = SQLInsert('methods', $methods[$m]);
                 }
             }
             if (is_array($objects) && !$only_classes) {
                 $total_o = count($objects);
                 for ($o = 0; $o < $total_o; $o++) {
                     $objects[$o]['CLASS_ID'] = $records[$i]['ID'];
                     $methods = $objects[$o]['METHODS'];
                     unset($objects[$o]['METHODS']);
                     $properties = $objects[$o]['PROPERTIES'];
                     unset($objects[$o]['PROPERTIES']);
                     $objects[$o]['ID'] = SQLInsert('objects', $objects[$o]);
                     if (is_array($properties)) {
                         $total_p = count($properties);
                         for ($p = 0; $p < $total_p; $p++) {
                             $properties[$p]['OBJECT_ID'] = $objects[$o]['ID'];
                             $properties[$p]['ID'] = SQLInsert('properties', $properties[$p]);
                         }
                     }
                     if (is_array($methods)) {
                         $total_m = count($methods);
                         for ($m = 0; $m < $total_m; $m++) {
                             $methods[$m]['OBJECT_ID'] = $objects[$o]['ID'];
                             $methods[$m]['ID'] = SQLInsert('methods', $methods[$m]);
                         }
                     }
                 }
             }
         }
         //print_r($records);
     }
     $this->updateTree_classes();
     $this->redirect("?");
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:91,代码来源:classes.class.php

示例9: substr

    $ED = $arEditions[LANG][$_REQUEST['edition']];
    if (is_array($ED['LIST'])) {
        $url = $_REQUEST['url'];
    } else {
        $url = $ED['LIST'];
    }
    if ($_REQUEST['LICENSE_KEY'] && false !== ($p = strpos($url, '/'))) {
        $url = substr($url, $p + 1);
    }
    $strRequestedUrl = $site . $path . $url . $suffix;
    $iTimeOut = TIMEOUT;
    $strUserAgent = "BitrixSiteLoader";
    $strFilename = $_SERVER["DOCUMENT_ROOT"] . "/" . basename($strRequestedUrl);
    $strLog = '';
    $status = '';
    $res = LoadFile($strRequestedUrl . ($_REQUEST["LICENSE_KEY"] != '' ? "?lp=" . md5($_REQUEST["LICENSE_KEY"]) : ''), $strFilename, $iTimeOut);
    if (!$res) {
        $txt = nl2br($strLog);
    } elseif ($res == 2) {
        $txt = $status;
        $script = "<script>GoToPage(\"" . $this_script_name . "?action=LOAD&edition=" . urlencode($_REQUEST['edition']) . "&url=" . urlencode($url) . "&lang=" . urlencode(LANG) . "&LICENSE_KEY=" . urlencode($_REQUEST["LICENSE_KEY"]) . "&action_next=" . urlencode($_REQUEST["action_next"]) . "&xz=" . rand(0, 32000) . "\");</script>\n";
    } else {
        $txt = $status;
        $script = "<script>GoToPage(\"" . $this_script_name . "?action=UNPACK&by_step=Y&filename=" . urlencode(basename($strRequestedUrl)) . "&lang=" . urlencode(LANG) . "&xz=" . rand(0, 32000) . "\");</script>\n";
    }
    $ar = array('FORM' => $form, 'TITLE' => LoaderGetMessage("LOADER_MENU_LOAD"), 'HEAD' => LoaderGetMessage("LOADER_MENU_LOAD"), 'TEXT' => $txt, 'BOTTOM' => '<input type="button" value="&nbsp;&nbsp;&nbsp;' . LoaderGetMessage("LOADER_BACK") . '&nbsp;&nbsp;&nbsp;" onclick="document.location=\'' . $this_script_name . '?action=LIST&lang=' . LANG . '\'">');
    /*********************************************************************/
} elseif ($strAction == "UNPACK") {
    /*********************************************************************/
    //	$iNumDistrFiles = 8000;
    SetCurrentStatus(LoaderGetMessage("LOADER_UNPACK_ACTION"));
开发者ID:alex19pov31,项目名称:webenv,代码行数:31,代码来源:bitrixsetup.php

示例10: SQLUpdate

  if (!$this->name_id) {
   $tmp=SQLSelectOne("SELECT ID, NAME FROM tdwiki");
   $this->name_id=$tmp['NAME'];
  }

  $rec=SQLSelectOne("SELECT * FROM $table_name WHERE NAME='".$this->name_id."'");

  if (!$rec['ID']) {
   $rec['NAME']=$this->name_id;
   $rec['CONTENT']=LoadFile(DIR_TEMPLATES.$this->name.'/default.html');
   $rec['ID']=SQLInsert($table_name, $rec);
  }


  if ($this->mode=='reset') {
   $rec['CONTENT']=LoadFile(DIR_TEMPLATES.$this->name.'/default.html');
   SQLUpdate($table_name, $rec);
   $this->redirect("?");
  }

  global $mode;

  if ($mode=='update') {
   global $content;
   //DebMes($content);
   $rec['CONTENT']=$content;
   SQLUpdate($table_name, $rec);
   echo "OK";
   exit;
  }
开发者ID:novozhenets,项目名称:majordomo,代码行数:30,代码来源:tdwiki_edit.inc.php

示例11: header

         header("Cache-Control: private");
         header("Pragma: no-cache");
         header("Content-type: multipart/x-mixed-replace; boundary={$boundary}");
         print "--{$boundary}\n";
         set_time_limit(0);
         @apache_setenv('no-gzip', 1);
         @ini_set('zlib.output_compression', 0);
         @ini_set('implicit_flush', 1);
         for ($i = 0; $i < ob_get_level(); $i++) {
             ob_end_flush();
         }
         ob_implicit_flush(1);
         while (true) {
             print "Content-type: image/jpeg\n\n";
             system(PATH_TO_FFMPEG . ' -rtsp_transport tcp -y -i "' . $url . '"' . $resize . ' -r 10 -f image2 -ss 00:00:01.500 -vframes 1 ' . $img);
             print LoadFile($img);
             print "--{$boundary}\n";
             sleep(1);
         }
     } else {
         system(PATH_TO_FFMPEG . ' -rtsp_transport tcp -y -i "' . $url . '"' . $resize . ' -r 10 -f image2 -ss 00:00:01.500 -vframes 1 ' . $img);
     }
     $dc = 1;
 } else {
     //echo $url.' - '.$username.' - '.$password;exit;
     $result = getURL($url, 0, $username, $password);
     if ($result) {
         if ($live) {
             $boundary = "my_mjpeg";
             header("Cache-Control: no-cache");
             header("Cache-Control: private");
开发者ID:kukuzhang,项目名称:majordomo,代码行数:31,代码来源:thumb.php

示例12: import_event

 function import_event(&$out)
 {
     global $file;
     global $overwrite;
     $data = LoadFile($file);
     $event = json_decode($this->removeBOM($data), true);
     if (is_array($event)) {
         $rec = SQLSelectOne("SELECT * FROM tlg_event WHERE TITLE='" . DBSafe($event["TITLE"]) . "'");
         if ($rec['ID']) {
             if ($overwrite) {
                 $event['ID'] = $rec['ID'];
                 SQLUpdate("tlg_event", $event);
                 // update
             } else {
                 $event["TITLE"] .= "_copy";
                 SQLInsert("tlg_event", $event);
                 // adding new record
             }
         } else {
             SQLInsert("tlg_event", $event);
         }
         // adding new record
     }
     $this->redirect("?tab=events");
 }
开发者ID:Anisan,项目名称:majordomo-telegram,代码行数:25,代码来源:telegram.class.php

示例13: MongoClient

try {
    $conn = new MongoClient(CONNECT);
    $db = $conn->kladr;
    $db->drop();
    foreach ($file_list as $key => $file) {
        $info = pathinfo($file);
        if ($info['filename'] == 'SOCRBASE') {
            LoadFile($db, $arLoaders, $file);
            unset($file_list[$key]);
            break;
        }
    }
    foreach ($file_list as $key => $file) {
        $info = pathinfo($file);
        if ($info['filename'] == 'ALTNAMES') {
            LoadFile($db, $arLoaders, $file);
            unset($file_list[$key]);
            break;
        }
    }
    foreach ($file_list as $file) {
        LoadFile($db, $arLoaders, $file);
    }
    //$db->altnames->drop();
    //$db->socrbase->drop();
    $conn->close();
} catch (MongoConnectionException $e) {
    die('Error connecting to MongoDB server');
} catch (MongoException $e) {
    die('Error: ' . $e->getMessage());
}
开发者ID:b2bpolis,项目名称:kladrapi,代码行数:31,代码来源:index.php

示例14: array

<?php

require_once 'configuration.php';
require_once 'view_helper.php';
require_once 'authenticate.php';
if (!isset($_GET['name'])) {
    exit;
} else {
    $view_name = $_GET['name'];
}
//var_dump($_POST);
//var_dump($_COOKIE);
$view_data = array();
if (count($_POST) > 0) {
    require_once VIEW_BASE_PATH . "{$view_name}_view_save.php";
}
if (($user_info = IsLoggedIn()) === false) {
    $view_data['is_logged_in'] = false;
} else {
    $view_data['is_logged_in'] = true;
    $view_data['user_id'] = $user_info['user_id'];
    $view_data['user_info'] = $user_info;
}
if (($html = LoadFile(VIEW_BASE_PATH . "{$view_name}_view.html", $view_data)) !== false) {
    echo $html;
}
开发者ID:guille-phillips,项目名称:phpprojects,代码行数:26,代码来源:view.php

示例15: admin

 /**
 * BackEnd
 *
 * Module backend
 *
 * @access public
 */
 function admin(&$out)
 {
     global $file;
     if ($this->view_mode == '') {
         $files = array();
         $dir = ROOT . 'texts';
         $handle = opendir($dir);
         while (false !== ($thing = readdir($handle))) {
             if ($thing == '.' || $thing == '..') {
                 continue;
             }
             if (preg_match('/(.+?)\\.txt$/', $thing, $m)) {
                 $files[] = array('FILENAME' => $m[1], 'FILENAME_URL' => urlencode($m[1]));
             }
         }
         closedir($handle);
         $out['FILES'] = $files;
     } elseif ($this->view_mode == 'delete_file' && $file != '') {
         @unlink(ROOT . 'texts/' . $file . ".txt");
         $this->redirect("?");
     } elseif ($this->view_mode == 'edit_file') {
         if ($this->mode == 'update' && $file != '') {
             global $data;
             SaveFile(ROOT . 'texts/' . $file . ".txt", trim($data));
             $out['OK'] = 1;
         }
         if ($file != '') {
             $data = LoadFile(ROOT . 'texts/' . $file . ".txt");
             $out['DATA'] = htmlspecialchars($data);
         }
         $out['FILE'] = $file;
         $out['FILE_URL'] = urlencode($out['FILE']);
     }
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:41,代码来源:textfiles.class.php


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