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


PHP file_get函数代码示例

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


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

示例1: _receiveJob

 function _receiveJob()
 {
     $result = '';
     $dir_jobs_queued = $this->_options['DirJobsQueued'];
     if (!$dir_jobs_queued) {
         throw new UnexpectedValueException('Configuration option DirJobsQueued required');
     }
     $path = end_with_slash($dir_jobs_queued);
     $job_id = '';
     if (file_exists($path) && is_dir($path)) {
         if ($dh = opendir($path)) {
             while (($file = readdir($dh)) !== false) {
                 if (substr($file, 0, 1) != '.') {
                     $xml = file_get($path . $file);
                     $this->_jobID = substr($file, 0, strpos($file, '.'));
                     $xml = @simplexml_load_string($xml);
                     if (!$xml) {
                         throw new RuntimeException('Could not parse job XML');
                     }
                     $this->_jobXML = $xml;
                     break;
                     // just do one
                 }
             }
             closedir($dh);
         }
     }
 }
开发者ID:ronniebrito,项目名称:moodle_moviemasher,代码行数:28,代码来源:Local.php

示例2: water

 /**
  * 为图片添加水印
  * @static public
  * @param string $source 原文件名
  * @param string $water  水印图片
  * @param string $$savename  添加水印后的图片名
  * @param string $alpha  水印的透明度
  * @return void
  */
 public static function water($source, $water, $savename = null, $alpha = 80, $get_source = true)
 {
     //[cluster]
     if ($get_source) {
         $source_tmp_name = tempnam(sys_get_temp_dir(), 'tp_');
         file_put_contents($source_tmp_name, file_get($source));
         $origin_savename = is_null($savename) ? $source : $savename;
         $source = $source_tmp_name;
     }
     //检查文件是否存在
     if (!file_exists($source) || !file_exists($water)) {
         return false;
     }
     //图片信息
     $sInfo = self::getImageInfo($source);
     $wInfo = self::getImageInfo($water);
     //如果图片小于水印图片,不生成图片
     if ($sInfo["width"] < $wInfo["width"] || $sInfo['height'] < $wInfo['height']) {
         return false;
     }
     //建立图像
     $sCreateFun = "imagecreatefrom" . $sInfo['type'];
     $sImage = $sCreateFun($source);
     $wCreateFun = "imagecreatefrom" . $wInfo['type'];
     $wImage = $wCreateFun($water);
     //设定图像的混色模式
     imagealphablending($wImage, true);
     //图像位置,默认为右下角右对齐
     $posY = $sInfo["height"] - $wInfo["height"];
     $posX = $sInfo["width"] - $wInfo["width"];
     //生成混合图像
     imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo['width'], $wInfo['height'], $alpha);
     //输出图像
     $ImageFun = 'Image' . $sInfo['type'];
     //如果没有给出保存文件名,默认为原图像名
     if (!$savename) {
         $savename = $source;
         @unlink($source);
     } elseif ($get_source) {
         //[cluster] 临时保存文件
         $savename = tempnam(sys_get_temp_dir(), 'tp_');
         @unlink($source);
     }
     //保存图像
     $ImageFun($sImage, $savename);
     imagedestroy($sImage);
     //[cluster] 上传文件
     if ($get_source) {
         file_upload($savename, $origin_savename);
         @unlink($savename);
     }
 }
开发者ID:ysking,项目名称:commlib,代码行数:61,代码来源:Image.class.php

示例3: parse_dict

function parse_dict($table)
{
    $names = array();
    if (is_file(DT_ROOT . '/file/setting/' . $table . '.csv')) {
        $tmp = file_get(DT_ROOT . '/file/setting/' . $table . '.csv');
        $arr = explode("\n", $tmp);
        foreach ($arr as $v) {
            $t = explode(',', $v);
            $names[$t[0]] = $t[1];
        }
    }
    return $names;
}
开发者ID:hcd2008,项目名称:destoon,代码行数:13,代码来源:data.inc.php

示例4: setUp

 public function setUp()
 {
     $this->isProject = getenv('IS_PROJECT');
     parent::setUp();
     // setup manifest
     $codexArr = json_decode(file_get($this->fixturesPath('codex.json')), true);
     $codexArr = Util::recursiveArrayStringReplace($codexArr, ['{vendor_dir}' => $this->basePath('vendor')]);
     file_put(storage_path('codex.json'), json_encode($codexArr));
     // setup misc
     file_touch(storage_path('codex.log'));
     $this->registerServiceProvider();
     $a = 'a';
 }
开发者ID:codexproject,项目名称:core,代码行数:13,代码来源:TestCase.php

示例5: get

 function get($key)
 {
     is_md5($key) or $key = md5($this->pre . $key);
     $php = DT_CACHE . '/php/' . substr($key, 0, 2) . '/' . $key . '.php';
     if (is_file($php)) {
         $str = file_get($php);
         $ttl = substr($str, 13, 10);
         if ($ttl < $this->time) {
             return '';
         }
         return substr($str, 23, 1) == '@' ? substr($str, 24) : unserialize(substr($str, 23));
     } else {
         return '';
     }
 }
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:15,代码来源:cache_file.class.php

示例6: private_signature

function private_signature($key_path, $data)
{
    $result = FALSE;
    if (function_exists('openssl_get_privatekey') && function_exists('openssl_sign') && function_exists('openssl_free_key')) {
        $key = file_get($key_path);
        if ($key) {
            $pkeyid = openssl_get_privatekey($key);
            if ($pkeyid) {
                if (openssl_sign($data, $result, $pkeyid)) {
                    $result = base64_encode($result);
                }
                openssl_free_key($pkeyid);
            }
        }
    }
    return $result;
}
开发者ID:ronniebrito,项目名称:moodle_moviemasher,代码行数:17,代码来源:cryptutils.php

示例7: _get

 function _get($type, $job_id)
 {
     $dir_cache = $this->getOption('DirCache');
     if (!$dir_cache) {
         throw new UnexpectedValueException('Configuration option DirCache required');
     }
     $path = end_with_slash($dir_cache) . $job_id . '/media.xml';
     $raw_xml = file_get($path);
     $result = '';
     //$progress = -1;
     $status = 'Progress or PercentDone tags not found in response';
     $progress = 10;
     // now if there is any problem we set the percent back to one and retry later
     if (!$raw_xml) {
         $status = 'Queued';
     } else {
         $raw_xml = '<moviemasher>' . $raw_xml . '</moviemasher>';
         $xml = $this->_parseResponse($raw_xml);
         if (!empty($xml->Progress) && is_object($xml->Progress)) {
             $data = $xml->Progress[sizeof($xml->Progress) - 1];
             if (!empty($data->PercentDone)) {
                 $progress = (string) $data->PercentDone;
                 if (!empty($data->Status)) {
                     $status = (string) $data->Status;
                 } else {
                     $progress = 10;
                     $status = 'Status tag empty';
                 }
             } else {
                 $status = 'PercentDone tag empty';
             }
         } else {
             $status = 'Progress tag empty';
         }
     }
     if (strpos($status, 'empty') !== FALSE) {
         $this->log($status . ' in response: ' . $raw_xml);
     }
     $result = array('percent' => $progress, 'status' => $status);
     return $result;
 }
开发者ID:ronniebrito,项目名称:moodle_moviemasher,代码行数:41,代码来源:Client.php

示例8: foreach

 foreach (glob(DT_ROOT . '/*.*') as $f) {
     $files[] = $f;
 }
 foreach ($filedir as $d) {
     $files = array_merge($files, get_file(DT_ROOT . '/' . $d, $fileext));
 }
 $lists = $mirror = array();
 if (is_file(DT_ROOT . '/file/md5/' . DT_VERSION . '.php')) {
     $content = substr(trim(file_get(DT_ROOT . '/file/md5/' . DT_VERSION . '.php')), 13);
     foreach (explode("\n", $content) as $v) {
         list($m, $f) = explode(' ', trim($v));
         $mirror[$m] = $f;
     }
 }
 foreach ($files as $f) {
     $content = file_get($f);
     if (preg_match_all('/(' . $code . ')/i', $content, $m)) {
         $r = $c = array();
         foreach ($m[1] as $v) {
             in_array($v, $c) or $c[] = $v;
         }
         $r['num'] = count($c);
         if ($r['num'] < $codenum && strpos($content, 'Zend') === false) {
             continue;
         }
         $r['file'] = str_replace(DT_ROOT . '/', '', $f);
         if ($mirror && in_array($r['file'], $mirror)) {
             if (md5_file($f) == array_search($r['file'], $mirror)) {
                 continue;
             }
         }
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:scan.inc.php

示例9: selectCountry

<html>
<head>
    <title>Land wählen</title>

    <script language="JavaScript" type="text/javascript" src="../global.js"></script>
    <script language="JavaScript" type="text/javascript" src="selcountry.js"></script>
    <script language="JavaScript" type="text/javascript">
        // @ by I.Runge 2004

        function selectCountry(name) {
//opener.xform.feld.value="name";
            opener.subnetgo(name);
            self.close();
        }

    </script>

</head>
<body style="font-family:arial;">

<?php 
define("IN_HTN", 1);
include "../gres.php";
echo str_replace("%path%", "../images/maps", file_get("../data/pubtxt/selcountry_body.txt"));
?>

</body>
</html>
开发者ID:dergriewatz,项目名称:htn-original,代码行数:28,代码来源:selcountry.php

示例10: action_submitcode

function action_submitcode()
{
    global $sessionid, $admin, $maxcodesize;
    if ($admin["mode"] != "Passive" && $admin["mode"] != "Active" && $_SESSION["status"] != "Admin") {
        $_SESSION["message"][] = "Code Submission Error : You are not allowed to submit solutions right now!";
        return;
    }
    if (!isset($_POST["code_pid"]) || empty($_POST["code_pid"]) || !isset($_POST["code_lang"]) || empty($_POST["code_lang"]) || !isset($_POST["code_name"]) || empty($_POST["code_name"])) {
        $_SESSION["message"][] = "Code Submission Error : Insufficient Data";
        return;
    }
    $data = mysql_query("SELECT status,languages,pgroup FROM problems WHERE pid='{$_POST['code_pid']}'");
    if (!is_resource($data) || mysql_num_rows($data) == 0) {
        $_SESSION["message"][] = "Code Submission Error : The specified problem does not exist.";
        return;
    }
    $data = mysql_fetch_array($data);
    if ($_SESSION["status"] != "Admin" && $data["status"] != "Active") {
        $_SESSION["message"][] = "Code Submission Error : The problem specified is not currently active.";
        return;
    }
    if ($_SESSION["status"] != "Admin" && eregi("^#[0-9]+ CQM\\-[0-9]+\$", $data["prgoup"]) && $admin["mode"] == "Passive") {
        $_SESSION["message"][] = "Code Submission Error : You can no longer submit solutions to this problem.";
        return;
    }
    if ($_SESSION["status"] != "Admin" && !in_array($_POST["code_lang"], explode(",", $data["languages"]))) {
        $_SESSION["message"][] = "Code Submission Error : The programming language specified is not allowed for this problem.";
        return;
    }
    // Lower Priority - Text
    if (strlen($_POST["code_text"]) > $maxcodesize) {
        $_SESSION["message"][] = "Code Submission Error : Submitted code exceeds size limits.";
        return;
    }
    $sourcecode = addslashes($_POST["code_text"]);
    // Higher Priority - File
    $ext = file_upload("code_file", "sys/temp/" . $sessionid . "_code", "text/plain,text/x-c,text/x-c++src,application/octet-stream,application/x-javascript,application/x-ruby", 100 * 1024);
    if ($ext != -1) {
        $sourcecode = addslashes(file_get("sys/temp/" . $sessionid . "_code.{$ext}"));
        unlink("sys/temp/" . $sessionid . "_code.{$ext}");
        $_POST["code_name"] = eregi_replace(".(b|c|cpp|java|pl|php|py|rb|txt)\$", "", basename($_FILES['code_file']['name']));
    }
    //echo "INSERT INTO runs (pid,tid,language,name,code,access,submittime) VALUES ('$_POST[code_pid]','$_SESSION[tid]','$_POST[code_lang]','$_POST[code_name]','$sourcecode','private',".time().")";
    if (!empty($sourcecode)) {
        mysql_query("INSERT INTO runs (pid,tid,language,name,code,access,submittime) VALUES ('{$_POST['code_pid']}','{$_SESSION['tid']}','{$_POST['code_lang']}','{$_POST['code_name']}','{$sourcecode}','private'," . time() . ")");
        $rid = mysql_insert_id();
        $_SESSION["message"][] = "Code Submission Successful.\nIf the code you submitted is not being evaluated immediately, please contact \"SourceCode\" on DC.";
        $_SESSION["redirect"] = "?display=code&rid={$rid}";
    } else {
        $_SESSION["message"][] = "Code Submission Error : Cannot submit empty code.";
    }
    return mysql_insert_id();
}
开发者ID:VaibhavAgarwalVA,项目名称:aurora-online-judge,代码行数:53,代码来源:system_code.php

示例11: file_get

    if ($backdays > 5) {
        ?>
 (<span class="f_red"><?php 
        echo $backdays;
        ?>
</span>天以前)<?php 
    }
    ?>
</a></td>
</tr>
</table>
<div class="tt">使用协议</div>
<table cellpadding="2" cellspacing="1" class="tb">
<tr>
<td style="padding:10px;"><textarea style="width:100%;height:100px;" onmouseover="this.style.height='600px';" onmouseout="this.style.height='100px';"><?php 
    echo file_get(DT_ROOT . '/license.txt');
    ?>
</textarea></td>
</tr>
</table>
<script type="text/javascript" src="<?php 
    echo $notice_url;
    ?>
"></script>
<script type="text/javascript">
var destoon_release = <?php 
    echo DT_RELEASE;
    ?>
;
var destoon_version = <?php 
    echo DT_VERSION;
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:main.tpl.php

示例12: dir_read

 if ($sql_dir) {
     $load_files = dir_read($sql_dir, null, array('.sql'), 'date_desc');
 }
 $load_assoc = array();
 if ($sql_dir) {
     foreach ($load_files as $file) {
         $file_path = $file;
         $file = basename($file);
         $load_assoc[$file] = '(' . substr(file_date($file_path), 0, 10) . ')' . ' ' . $file;
     }
 }
 if ($sql_dir && 'load' == $post['perform']) {
     $file = $sql_dir . '/' . $post['load_from'];
     if (array_key_exists($post['load_from'], $load_assoc) && file_exists($file)) {
         $msg .= sprintf('<div>Sql loaded: %s (%s)</div>', basename($file), timestamp(file_date($file)));
         $post['sql'] = file_get($file);
         $post['save_as'] = basename($file);
         $post['save_as'] = str_replace('.sql', '', $post['save_as']);
     } else {
         error('<div>File not found: %s</div>', $file);
     }
 }
 // after load - md5 may change
 $md5 = md5($post['sql']);
 if ($sql_dir && 'load' == $post['perform'] && !error()) {
     $md5_tmp = sprintf($sql_dir . '/zzz_%s.dat', $md5);
     file_put($md5_tmp, $post['sql']);
 }
 $is_sel = false;
 $queries = preg_split("#;(\\s*--[ \t\\S]*)?(\r\n|\n|\r)#U", $post['sql']);
 foreach ($queries as $k => $query) {
开发者ID:rubencamargogomez,项目名称:custom_properties,代码行数:31,代码来源:dbkiss.php

示例13: split_sell

function split_sell($part)
{
    global $db, $CFG, $MODULE;
    $sql = file_get(DT_ROOT . '/file/setting/split_sell.sql');
    $sql or dalert('请检查文件file/setting/split_sell.sql是否存在');
    $sql = str_replace('destoon_sell', $db->pre . 'sell_' . $part, $sql);
    if ($db->version() > '4.1' && $CFG['db_charset']) {
        $sql .= " ENGINE=MyISAM DEFAULT CHARSET=" . $CFG['db_charset'];
    } else {
        $sql .= " TYPE=MyISAM";
    }
    $sql .= " COMMENT='" . $MODULE[5]['name'] . "分表_" . $part . "';";
    $db->query($sql);
}
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:14,代码来源:global.func.php

示例14: msg

 if (isset($import)) {
     if (isset($filename) && $filename && file_ext($filename) == 'sql') {
         $dfile = $D . $filename;
         if (!is_file($dfile)) {
             msg('文件不存在,请检查');
         }
         $sql = file_get($dfile);
         sql_execute($sql);
         msg($filename . ' 导入成功', '?file=' . $file . '&action=import');
     } else {
         $fileid = isset($fileid) ? $fileid : 1;
         $tid = isset($tid) ? intval($tid) : 0;
         $filename = is_dir($D . $filepre) ? $filepre . '/' . $fileid : $filepre . $fileid;
         $filename = $D . $filename . '.sql';
         if (is_file($filename)) {
             $sql = file_get($filename);
             if (substr($sql, 0, 11) == '# Destoon V') {
                 $v = substr($sql, 11, 3);
                 if (DT_VERSION != $v) {
                     msg('由于数据结构存在差异,备份数据不可以跨版本导入<br/>备份版本:V' . $v . '<br/>当前系统:V' . DT_VERSION);
                 }
             }
             sql_execute($sql);
             $prog = $tid ? progress(1, $fileid, $tid) : '';
             msg('分卷 <strong>#' . $fileid++ . '</strong> 导入成功 程序将自动继续...' . $prog, '?file=' . $file . '&action=' . $action . '&filepre=' . $filepre . '&fileid=' . $fileid . '&tid=' . $tid . '&import=1');
         } else {
             msg('数据库恢复成功', '?file=' . $file . '&action=import');
         }
     }
 } else {
     $dbak = $dbaks = $dsql = $dsqls = $sql = $sqls = array();
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:database.inc.php

示例15: drawSimpleTop

function drawSimpleTop($title = false)
{
    //leave title empty for emails
    $return = url_header_utf8() . draw_doctype() . '
		<head>' . draw_meta_utf8() . draw_favicon(DIRECTORY_WRITE . '/favicon.png') . draw_css(file_get('/css/simple.css'));
    if ($title) {
        $return .= draw_container('title', $title);
        $return .= draw_javascript_src();
        $return .= draw_javascript_src('/javascript.js');
    }
    $return .= '</head>
		<body class="s">';
    return $return;
}
开发者ID:Rhenan,项目名称:intranet-1,代码行数:14,代码来源:include.php


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