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


PHP _file_get_contents函数代码示例

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


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

示例1: saveLogs

/**
 * Saves cronjob handler activity to a log file.
 *
 * @since 6.0.00
 */
function saveLogs($text)
{
    $cronDir = cronDir() . 'cron/';
    if (!file_put_contents($cronDir . 'logs/cronjobs.log', date('Y-m-d H:i:s') . ' - ' . $text . PHP_EOL . _file_get_contents($cronDir . 'logs/cronjobs.log'))) {
        etsis_monolog('cron', _t('cannot write to cronjobs database file, please check file rights'), 'addError');
    }
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:12,代码来源:cron.router.php

示例2: get

 /**
  * @desc   $max_times 过期时间,获取的时候需要设置.在系统负载压力过大的时候,仍然返回数据,默认保留10个小时
  * @author
  * @since  2013-07-14 15:55:31
  * @throws 注意:无DB异常处理
  */
 function get($key, $max_times = 36000)
 {
     $unserialize = NULL;
     $file = $this->_dir($key);
     if (_sys_overload()) {
         _status(1, VHOST . "(本机缓存)", "过载命中");
         $unserialize = unserialize(_file_get_contents($file));
     } elseif (filemtime($file) > time() - $max_times) {
         $unserialize = unserialize(_file_get_contents($file));
     }
     if ($unserialize) {
         _status(1, VHOST . "(本机缓存)", "命中");
     } else {
         _status(1, VHOST . "(本机缓存)", "未命中");
     }
     return $unserialize;
 }
开发者ID:sdgdsffdsfff,项目名称:phpapm,代码行数:23,代码来源:shm_cache.class.php

示例3: _t

	<div class="modal fade" id="myModal">
		<div class="modal-dialog">
			<div class="modal-content">
				<!-- Modal heading -->
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h3 class="modal-title"><?php 
echo _t('Person Search');
?>
</h3>
				</div>
				<!-- // Modal heading END -->
				<!-- Modal body -->
				<div class="modal-body">
					<?php 
echo _file_get_contents(APP_PATH . 'Info/person-search.txt');
?>
				</div>
				<!-- // Modal body END -->
				<!-- Modal footer -->
				<div class="modal-footer">
					<a href="#" class="btn btn-default" data-dismiss="modal"><?php 
echo _t('Close');
?>
</a> 
				</div>
				<!-- // Modal footer END -->
			</div>
		</div>
	</div>
	<!-- // Modal END -->
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:31,代码来源:index.php

示例4: etsis_dropdown_languages

/**
 * Retrieves a list of available locales.
 * 
 * @since 6.1.09
 * @param string $active
 */
function etsis_dropdown_languages($active = '')
{
    if (function_exists('enable_url_ssl')) {
        $protocol = 'https://';
    } else {
        $protocol = 'http://';
    }
    $locales = _file_get_contents($protocol . 'etsis.s3.amazonaws.com/core/1.1/translations.json');
    $json = json_decode($locales, true);
    foreach ($json as $locale) {
        echo '<option value="' . $locale['language'] . '"' . selected($active, $locale['language'], false) . '>' . $locale['native_name'] . '</option>';
    }
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:19,代码来源:textdomain-function.php

示例5: file_exists

            </div>
            <!-- // Tabs Heading END -->
            
			<div class="widget-body">
			
				<!-- Row -->
				<div class="row">
					
					<!-- Column -->
					<div class="col-md-12">
						
						<!-- Group -->
						<div class="form-group">
							<div class="col-md-12">
								<textarea class="col-md-12 form-control" rows="10"><?php 
echo file_exists($cronlog) ? _file_get_contents($cronlog) : 'No log found';
?>
</textarea>
							</div>
						</div>
						<!-- // Group END -->
						
					</div>
					<!-- // Column END -->
					
				</div>
				<!-- // Row END -->
			
				<hr class="separator" />
				
				<!-- Form actions -->
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:31,代码来源:log.php

示例6: function

 $app->delete('/(\\w+)/(\\w+)/(\\d+)', function ($table, $field, $id) use($app) {
     $query = [sprintf('DELETE FROM %s WHERE %s = ?', $table, $field)];
     $query = sprintf('%s;', implode(' ', $query));
     $result = $app->db->query($query, [$id]);
     if ($result === false) {
         $app->res->_format('json', 404);
     } else {
         if (empty($result) === true) {
             $app->res->_format('json', 204);
         } else {
             $app->res->_format('json');
         }
     }
 });
 if (in_array($http = strtoupper($_SERVER['REQUEST_METHOD']), ['POST', 'PUT']) === true) {
     if (preg_match('~^\\x78[\\x01\\x5E\\x9C\\xDA]~', $data = _file_get_contents('php://input')) > 0) {
         $data = gzuncompress($data);
     }
     if (array_key_exists('CONTENT_TYPE', $_SERVER) === true && empty($data) !== true) {
         if (strncasecmp($_SERVER['CONTENT_TYPE'], 'application/json', 16) === 0) {
             $GLOBALS['_' . $http] = json_decode($data, true);
         } else {
             if (strncasecmp($_SERVER['CONTENT_TYPE'], 'application/x-www-form-urlencoded', 33) === 0 && strncasecmp($_SERVER['REQUEST_METHOD'], 'PUT', 3) === 0) {
                 parse_str($data, $GLOBALS['_' . $http]);
             }
         }
     }
     if (isset($GLOBALS['_' . $http]) !== true || is_array($GLOBALS['_' . $http]) !== true) {
         $GLOBALS['_' . $http] = [];
     }
     unset($data);
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:31,代码来源:api.router.php

示例7: getCurrentRelease

 protected function getCurrentRelease()
 {
     $file = parse_ini_string(_file_get_contents($this->url . 'core/1.1/update-check/etsis.ini'), true);
     return $file;
 }
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:5,代码来源:etsis_Updater.php

示例8: _t

                </div>
				<div class="modal fade" id="myModal">
					<div class="modal-dialog">
						<div class="modal-content">
							<!-- Modal heading -->
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
								<h3 class="modal-title"><?php 
echo _t('Person Type');
?>
</h3>
							</div>
							<!-- // Modal heading END -->
		                    <div class="modal-body">
		                        <?php 
echo _file_get_contents(APP_PATH . 'Info/person-type.txt');
?>
		                    </div>
		                    <div class="modal-footer">
		                        <a href="#" data-dismiss="modal" class="btn btn-primary"><?php 
echo _t('Cancel');
?>
</a>
		                    </div>
	                   	</div>
                  	</div>
                </div>
				
				<!-- Form actions -->
				<div class="form-actions">
					<button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i><?php 
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:31,代码来源:add.php

示例9: get_name

     } else {
         $app->view->display('staff/view', ['title' => get_name($staf->staffID), 'cssArray' => $css, 'jsArray' => $js, 'staff' => $staf, 'addr' => $q]);
     }
 });
 /**
  * Before route middleware check.
  */
 $app->before('GET|POST', '/add/(\\d+)/', function ($id) {
     if (!hasPermission('create_staff_record')) {
         redirect(get_base_url() . 'dashboard' . '/');
     }
 });
 $app->match('GET|POST', '/add/(\\d+)/', function ($id) use($app, $css, $js, $json_url, $flashNow) {
     $json_p = _file_get_contents($json_url . 'person/personID/' . $id . '/?key=' . get_option('api_key'));
     $p_decode = json_decode($json_p, true);
     $json_s = _file_get_contents($json_url . 'staff/staffID/' . $id . '/?key=' . get_option('api_key'));
     $s_decode = json_decode($json_s, true);
     if ($app->req->isPost()) {
         $staff = $app->db->staff();
         $staff->staffID = $id;
         $staff->schoolCode = $_POST['schoolCode'];
         $staff->buildingCode = $_POST['buildingCode'];
         $staff->officeCode = $_POST['officeCode'];
         $staff->office_phone = $_POST['office_phone'];
         $staff->deptCode = $_POST['deptCode'];
         $staff->status = $_POST['status'];
         $staff->addDate = $staff->NOW();
         $staff->approvedBy = get_persondata('personID');
         /**
          * Fires during the saving/creating of a staff record.
          *
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:31,代码来源:staff.router.php

示例10: _file_get_contents

                    }
                }
            }
            $args[0] = $matches[2];
            //filename
            $args[1] = $matches[3];
            //type
            $args[2] = $tmp_name;
            //tmp_name
            $args[3] = 0;
            //error
            $args[4] = $size;
            //size
            $_FILES[$name] = $file;
        }
    }
}
function _file_get_contents()
{
    $dir_path = 'upload/';
    $img_path = $_FILES['files']['tmp_name'];
    $type = explode('/', $_FILES['files']['type'])[1];
    $content = file_get_contents($img_path);
    if ($content !== false) {
        $file_name = explode('.', end(explode('\\', $img_path)))[0];
        file_put_contents($dir_path . $file_name . '.' . $type, $content);
    }
}
_put_save_for_upload();
_file_get_contents();
开发者ID:pouu69,项目名称:put_request_for_upload,代码行数:30,代码来源:upload.php

示例11: run_test


//.........这里部分代码省略.........
        $opts["http"]["content"] = $request;
        if (empty($request)) {
            error("POST empty in '{$file}'");
        }
    } else {
        if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
            $post = trim($section_text['POST']);
            if (array_key_exists('GZIP_POST', $section_text) && function_exists('gzencode')) {
                $post = gzencode($post, 9, FORCE_GZIP);
                $env['HTTP_CONTENT_ENCODING'] = 'gzip';
            } else {
                if (array_key_exists('DEFLATE_POST', $section_text) && function_exists('gzcompress')) {
                    $post = gzcompress($post, 9);
                    $env['HTTP_CONTENT_ENCODING'] = 'deflate';
                }
            }
            //save_text($tmp_post, $post);
            $content_length = strlen($post);
            $env['REQUEST_METHOD'] = 'POST';
            $env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
            $env['CONTENT_LENGTH'] = $content_length;
            $opts["http"]["method"] = "POST";
            $opts["http"]["header"] .= "Content-type: " . $env['CONTENT_TYPE'] . "\r\n";
            $opts["http"]["header"] .= "Content-encoding: " . $env['HTTP_CONTENT_ENCODING'] . "\r\n";
            $opts["http"]["header"] .= "Content-length: " . $content_length . "\r\n";
            $opts["http"]["content"] = $post;
        } else {
            $env['REQUEST_METHOD'] = 'GET';
            $env['CONTENT_TYPE'] = '';
            $env['CONTENT_LENGTH'] = '';
        }
    }
    $context = stream_context_create($opts);
    $out = _file_get_contents($www . $phpfile, false, $context, &$headers);
    if ($out === FALSE) {
        echo '<br/>';
        error("See <a target='_blank' href='{$phpfile}'>{$phpfile}</a>, exception ");
    }
    if (StartsWith($out, "\r\nCompileError") || StartsWith($out, "\r\nCompileWarning")) {
        show_result("<span class='skip'>SKIP</span>", $file, ", Script generates <b>CompileError</b> or <b>CompileWarning</b>, so it cannot be compared with PHP. <a href='{$phpfile}' target='_blank'>Try the script</a><pre>{$out}</pre>");
    }
    // perform clean
    try_clean($file, $www, $section_text);
    // compare .php response with expected output
    // Does the output match what is expected?
    $output = preg_replace("/\r\n/", "\n", trim($out));
    $output = str_replace("string[binary](", "string(", $output);
    $failed_headers = false;
    if (isset($section_text['EXPECTHEADERS'])) {
        $want = array();
        $wanted_headers = array();
        $lines = preg_split("/[\n\r]+/", (string) $section_text['EXPECTHEADERS']);
        foreach ($lines as $line) {
            if (strpos($line, ':') !== false) {
                $line = explode(':', $line, 2);
                $want[trim($line[0])] = trim($line[1]);
                $wanted_headers[] = trim($line[0]) . ': ' . trim($line[1]);
            }
        }
        $org_headers = $headers;
        $headers = array();
        $output_headers = array();
        foreach ($want as $k => $v) {
            if (isset($org_headers[$k])) {
                $headers = $org_headers[$k];
                $output_headers[] = $k . ': ' . $org_headers[$k];
开发者ID:dw4dev,项目名称:Phalanger,代码行数:67,代码来源:index.php

示例12: function

 $app->before('GET|POST', '/add-prog/(\\d+)/', function () {
     if (!hasPermission('create_stu_record')) {
         redirect(get_base_url() . 'dashboard' . '/');
     }
     /**
      * If user is logged in and the lockscreen cookie is set, 
      * redirect user to the lock screen until he/she enters 
      * his/her password to gain access.
      */
     if (isset($_COOKIE['SCREENLOCK'])) {
         redirect(get_base_url() . 'lock' . '/');
     }
 });
 $app->match('GET|POST', '/add-prog/(\\d+)/', function ($id) use($app, $css, $js, $json_url, $flashNow) {
     if ($app->req->isPost()) {
         $json = _file_get_contents($json_url . 'acad_program/acadProgCode/' . $_POST['acadProgCode'] . '/?key=' . get_option('api_key'));
         $decode = json_decode($json, true);
         $level = $app->db->stu_acad_level()->where('stuID = ?', $id)->_and_()->where('acadProgCode = ?', $_POST['acadProgCode']);
         $sql = $level->find(function ($data) {
             $array = [];
             foreach ($data as $d) {
                 $array[] = $d;
             }
             return $array;
         });
         $sacp = $app->db->stu_program();
         $sacp->stuID = $id;
         $sacp->acadProgCode = _trim($_POST['acadProgCode']);
         $sacp->currStatus = $_POST['currStatus'];
         $sacp->statusDate = $app->db->NOW();
         $sacp->startDate = $_POST['startDate'];
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:31,代码来源:student.router.php

示例13: read

 public function read()
 {
     return @_file_get_contents($this->_path);
 }
开发者ID:WKnight02,项目名称:BitterFox_III,代码行数:4,代码来源:File.php

示例14: etsis_php_check_includes

/**
 * Performs a check within a php script and returns any other files
 * that might have been required or included.
 *
 * @since 6.2.0
 * @param string $file_name
 *            PHP script to check.
 */
function etsis_php_check_includes($file_name)
{
    if ('' == _trim($file_name)) {
        $message = _t('Invalid file name: empty file name given.');
        _incorrectly_called(__FUNCTION__, $message, '6.2.0');
        return;
    }
    // NOTE that any file coming into this function has already passed the syntax check, so
    // we can assume things like proper line terminations
    $includes = [];
    // Get the directory name of the file so we can prepend it to relative paths
    $dir = dirname($file_name);
    // Split the contents of $fileName about requires and includes
    // We need to slice off the first element since that is the text up to the first include/require
    $requireSplit = array_slice(preg_split('/require|include/i', _file_get_contents($file_name)), 1);
    // For each match
    foreach ($requireSplit as $string) {
        // Substring up to the end of the first line, i.e. the line that the require is on
        $string = substr($string, 0, strpos($string, ";"));
        // If the line contains a reference to a variable, then we cannot analyse it
        // so skip this iteration
        if (strpos($string, "\$") !== false) {
            continue;
        }
        // Split the string about single and double quotes
        $quoteSplit = preg_split('/[\'"]/', $string);
        // The value of the include is the second element of the array
        // Putting this in an if statement enforces the presence of '' or "" somewhere in the include
        // includes with any kind of run-time variable in have been excluded earlier
        // this just leaves includes with constants in, which we can't do much about
        if ($include = $quoteSplit[1]) {
            // If the path is not absolute, add the dir and separator
            // Then call realpath to chop out extra separators
            if (strpos($include, ':') === FALSE) {
                $include = realpath($dir . DS . $include);
            }
            array_push($includes, $include);
        }
    }
    return $includes;
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:49,代码来源:core-function.php

示例15: getStats

 /**
  * Echoes the stats of the cache.
  *
  * Gives the cache hits, cache misses and cache uptime.
  *
  * @since 6.2.0
  */
 public function getStats()
 {
     if (!$this->enable) {
         return false;
     }
     echo "<p>";
     echo "<strong>" . _t('Cache Hits:') . "</strong> " . _file_get_contents($this->_dir . 'cache_hits.txt') . "<br />";
     echo "<strong>" . _t('Cache Misses:') . "</strong> " . _file_get_contents($this->_dir . 'cache_misses.txt') . "<br />";
     echo "<strong>" . _t('Uptime:') . "</strong> " . timeAgo(file_mod_time($this->_dir)) . "<br />";
     echo "</p>";
 }
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:18,代码来源:etsis_Cache_Cookie.php


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