本文整理汇总了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');
}
}
示例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;
}
示例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">×</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 -->
示例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>';
}
}
示例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 -->
示例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);
示例7: getCurrentRelease
protected function getCurrentRelease()
{
$file = parse_ini_string(_file_get_contents($this->url . 'core/1.1/update-check/etsis.ini'), true);
return $file;
}
示例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">×</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
示例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.
*
示例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();
示例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];
示例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'];
示例13: read
public function read()
{
return @_file_get_contents($this->_path);
}
示例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;
}
示例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>";
}