本文整理汇总了PHP中get_file_info函数的典型用法代码示例。如果您正苦于以下问题:PHP get_file_info函数的具体用法?PHP get_file_info怎么用?PHP get_file_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_file_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hiddenVerify
function hiddenVerify($strVal, $strOpts)
{
//---------------------------------------------------------------------
//
//---------------------------------------------------------------------
global $gbShowHiddenVerifyError;
$CI =& get_instance();
$gbShowHiddenVerifyError = true;
$aOpts = explode(',', $strOpts);
$strVerificationModule = trim($aOpts[0]);
$strVModEntryPoint = trim($aOpts[1]);
// does the file exist?
$strFullFN = './application/helpers/custom_verification/' . $strVerificationModule;
$fArray = get_file_info($strFullFN);
if ($fArray === false) {
$CI->form_validation->set_message('hiddenVerify', 'Unable to find custom validation file! Please check with your system administrator.');
return false;
}
// extract the helper name, then load helper
$strHelperName = substr($strVerificationModule, 0, strlen($strVerificationModule) - 11);
$CI->load->helper('custom_verification/' . $strHelperName);
// does the entry point exist?
if (!is_callable($strVModEntryPoint)) {
$CI->form_validation->set_message('hiddenVerify', 'Unable to find the entry point for custom validation file! Please check with your system administrator.');
return false;
}
$gbShowHiddenVerifyError = false;
return call_user_func($strVModEntryPoint);
}
示例2: _check_installation
/**
* checks if site is installed... and configured... if not redirects to install script
*/
function _check_installation()
{
// if there is no site_config.php it's not installed
$this->load->helper('file');
$info = get_file_info(APPPATH . "config/site_config.php");
if ($info === false) {
redirect('/install', 'location');
}
}
示例3: fileInfo
function fileInfo($path, $output)
{
$CI =& get_instance();
$CI->load->helper('file');
$item = get_file_info($path, array($output));
foreach ($item as $ritem) {
return $ritem;
}
}
示例4: Install
function Install()
{
parent::Controller();
$this->load->helper('file');
$info = get_file_info(APPPATH . "config/site_config.php");
if ($info !== false) {
// daca site-ul este deja instalat iesim de aici...
redirect('/home', 'location');
}
}
示例5: _test_get_file_info
private function _test_get_file_info($vals)
{
$content = 'Jack and Jill went up the mountain to fight a billy goat.';
$last_modified = time() - 86400;
$file = vfsStream::newFile('my_file.txt', 0777)->withContent($content)->lastModified($last_modified)->at($this->_test_dir);
$ret_values = array('name' => 'my_file.txt', 'server_path' => 'vfs://my_file.txt', 'size' => 57, 'date' => $last_modified, 'readable' => TRUE, 'writable' => TRUE, 'executable' => TRUE, 'fileperms' => 33279);
$info = get_file_info(vfsStream::url('my_file.txt'), $vals);
foreach ($info as $k => $v) {
$this->assertEquals($ret_values[$k], $v);
}
}
示例6: updateDBConfigFile
function updateDBConfigFile($strDBName, $strDBHost, $strUserName, $strPWord)
{
//---------------------------------------------------------------------
//
//---------------------------------------------------------------------
$strDBConfigFN = set_realpath('.') . 'application/config/database.php';
$fInfo = get_file_info($strDBConfigFN);
if ($fInfo === false) {
$this->bError = true;
$this->strErrMsg = 'Can not find the database configuration file ' . $strDBConfigFN . '<br>';
return;
}
$strDBConfig = '<?php' . "\n" . '/* ----------------------------' . "\n" . ' Database configuration entries updated on ' . date('Y-m-d H:i:s') . ' for the ' . "\n" . ' Delightful Labor installation. ' . "\n\n" . ' Updates can be found at the bottom of this file.' . "\n" . ' ----------------------------*/' . "\n" . "?>" . read_file($strDBConfigFN) . "\n\n" . '/* ----------------------------' . "\n" . ' Delightful Labor database settings. ' . "\n" . ' ----------------------------*/' . "\n" . "\$db['default']['hostname'] = '{$strDBHost}';\n" . "\$db['default']['username'] = '{$strUserName}';\n" . "\$db['default']['password'] = '{$strPWord}';\n" . "\$db['default']['database'] = '{$strDBName}';\n";
write_file($strDBConfigFN, $strDBConfig);
}
示例7: ada_foto
function ada_foto($file)
{
$CI =& get_instance();
$CI->load->helper('file');
$cek_foto = get_file_info('./assets/img/foto_conto/' . $file);
if (!$cek_foto) {
return FALSE;
} else {
if (empty($file)) {
return FALSE;
} else {
return TRUE;
}
}
}
示例8: list_functions_in_files
/**
* Open each files, compile a list of functions within
* @param string $folder
* @param array $array_of_filenames
* @param $new_array
*/
private function list_functions_in_files($folder, $array_of_filenames, &$new_array)
{
$this->load->helper('file');
foreach ($array_of_filenames as $key => $filename) {
if (is_array($filename)) {
$this->list_functions_in_files($folder . $key . '/', $filename, $new_array);
} else {
if (!in_array($filename, $this->file_exclude)) {
$file_content = read_file('./' . $folder . $filename);
$new_array[] = array('filename' => $filename, 'info' => get_file_info('./' . $folder . $filename), 'functions' => $this->discover_functions_in_content($file_content));
}
}
}
return $new_array;
}
示例9: propriedades_arquivos
function propriedades_arquivos($arquivo, $complemento = '')
{
$ci =& get_instance();
if (!file_exists($arquivo)) {
return $dadosImagem['localizacao'] = false;
} else {
$arquivoDados = explode('/', $arquivo);
$extension = substr(strrchr($arquivo, '.'), 1);
if ($extension != null) {
$ci->load->helper('file');
$mime = get_mime_by_extension($arquivo);
if ($mime != false) {
$mime2 = explode('/', get_mime_by_extension($arquivo));
} else {
$mime2[0] = "desconhecido";
$mime2[1] = "desconhecido";
}
} else {
$mime2[0] = "desconhecido";
$mime2[1] = "desconhecido";
$mime = null;
}
}
$ci->load->helper('file');
$size = get_file_info($arquivo, array('name', 'server_path', 'size', 'date', 'readable', 'writable', 'executable', 'fileperms'));
$dadosImagem = array();
foreach ($size as $k => $v) {
$dadosImagem[$complemento . $k] = $v;
}
$dadosImagem[$complemento . 'localizacao'] = true;
$dadosImagem[$complemento . 'mime'] = $mime;
$dadosImagem[$complemento . 'mimeTipo'] = isset($mime2[0]) ? $mime2[0] : '';
$dadosImagem[$complemento . 'mimeSub'] = isset($mime2[1]) ? $mime2[1] : '';
$dadosImagem[$complemento . 'arquivo_formatado'] = renomear_arquivos($arquivoDados[count($arquivoDados) - 1]);
$dadosImagem[$complemento . 'date_formatado'] = date('Y-m-d H:i:s', $size['date']);
if ($mime2[0] == 'image') {
$propriedades = getimagesize($arquivo);
$dadosImagem[$complemento . 'largura'] = $propriedades[0];
$dadosImagem[$complemento . 'altura'] = $propriedades[1];
} else {
$dadosImagem[$complemento . 'largura'] = null;
$dadosImagem[$complemento . 'altura'] = null;
}
return $dadosImagem;
}
示例10: __construct
/** 생성자 */
function __construct()
{
parent::__construct();
$this->load->helper('file');
$pos = strpos($this->input->server('PHP_SELF'), '/index.php') + 1;
$html_root = substr($this->input->server('PHP_SELF'), 0, $pos) . 'html';
$domain = str_replace('www.', '', $this->input->server('SERVER_NAME'));
// 도메인으로 등록여부를 체크...
// $query = $this->db->query("SELECT * FROM k_site WHERE domain='{$domain}'");
// print_r($query->row());
// 화면 설정 파일 인클루드...
$config_file = get_file_info(rtrim(getenv("DOCUMENT_ROOT"), '/') . $html_root . '/view/' . $domain . '/config.php');
if ($config_file) {
require_once $config_file['server_path'];
$this->html = $html;
$this->html['root'] = $html_root;
}
}
示例11: save
function save($root, $path, $data)
{
$playlist_file_info = get_file_info($path);
// Reference: http://stackoverflow.com/questions/689185/json-decode-returns-null-php
if (get_magic_quotes_gpc()) {
// Remove PHP magic quotes
$data = stripslashes($data);
}
$data = json_decode($data, true);
if ($data == null) {
die('Playlist could not be saved: Could not parse json data');
}
$handle = @fopen($playlist_file_info['path'], 'w') or die('Playlist could not be saved: Could not open file for writing');
fwrite($handle, playlist_header() . LINE_BREAK);
fwrite($handle, implode("\n", playlist_contents($playlist_file_info['path'], $data)));
fclose($handle);
echo 'Playlist saved successfully';
}
示例12: getFileSize
private function getFileSize($id, $fn)
{
$this->load->helper('file');
$r = "0 KB";
$fp = $this->filepath . $id . DIRECTORY_SEPARATOR . $fn;
$fileinfo = get_file_info($fp);
if ($fileinfo) {
if (isset($fileinfo["size"])) {
$unit = " KB";
$size = $fileinfo["size"] / 1024;
if ($size >= 1024) {
$size = $size / 1024;
$unit = " MB";
}
$r = round($size, 2) . $unit;
}
}
return $r;
}
示例13: test
public function test()
{
//$this->load->helper('file');
//返回和index.php在同一个目录下的test.txt文件的内容,使用的是原生的php函数
echo file_get_contents('test.txt');
$this->load->helper('file');
$data = 'Some file data<br/>';
//write_file方法会覆盖文件中已有的内容
if (!write_file('test.txt', $data)) {
echo 'Unable to write the file<br/>';
} else {
echo 'File written!<br/>';
}
// if (delete_files('zcyytest/')) {
// echo '删除成功!<br/>';
// } else {
// echo '删除失败!<br/>';
// }
//连这个目录下的文件夹一起删除
// if (delete_files('zcyytest/', TRUE)) {
// echo '删除成功!<br/>';
// } else {
// echo '删除失败!<br/>';
// }
echo APPPATH . '<br/>';
$controllers = get_filenames(APPPATH . '../' . 'zcyytest/');
print_r($controllers);
echo '<br/>';
$models_info = get_dir_file_info(APPPATH . '../' . 'zcyytest/');
print_r($models_info);
echo '<br/>';
print_r(get_file_info(APPPATH . '../' . 'zcyytest/1.txt'));
echo '<br/>';
//将文件权限的数字格式(例如 fileperms() 函数的返回值)转换为标准的符号格式。
echo symbolic_permissions(fileperms('test.txt'));
echo '<br/>';
//将文件权限的数字格式(例如 fileperms() 函数的返回值)转换为三个字符的八进制表示格式。
echo octal_permissions(fileperms('test.txt'));
echo '<br/>';
}
示例14: index
public function index()
{
$this->Purview_model->checkPurview($this->tablefunc);
$folder = $this->input->post('folder');
if (!$folder) {
$folder = $this->defaultfolder;
}
$listarr = directory_map($folder, 1);
$folderlist = array();
$phplist = array();
$csslist = array();
$jslist = array();
foreach ($listarr as $list) {
$thispath = $folder . '/' . $list;
$newlist = get_file_info($thispath);
$newlist['permissions'] = octal_permissions(fileperms($thispath));
$newlist['name'] = $list;
if (is_dir($thispath)) {
$folderlist[] = $newlist;
} else {
$newlist['size'] = byte_format($newlist['size']);
$ext = get_suffix($thispath);
switch ($ext) {
case 'php':
$phplist[] = $newlist;
break;
case 'css':
$csslist[] = $newlist;
break;
case 'js':
$jslist[] = $newlist;
break;
default:
break;
}
}
}
$res = array('tpl' => 'list', 'tablefunc' => $this->tablefunc, 'folderlist' => $folderlist, 'phplist' => $phplist, 'csslist' => $csslist, 'jslist' => $jslist, 'defaultfolder' => $this->defaultfolder, 'folder' => $folder);
$this->load->view($this->tablefunc, $res);
}
示例15: clean_temp
function clean_temp($mode = 'day', $max = 1)
{
$CI =& get_instance();
$CI->load->helper('directory');
$CI->load->helper('file');
//$directory = '/var/www/temp/';
$directory = TEMPPATH;
$files = directory_map($directory);
$now = time();
$files_to_take[] = 'picture.jpg';
$files_to_take[] = 'fab_ui_safety.json';
$files_to_take[] = 'instagram_feed.json';
$files_to_take[] = 'instagram_hash.json';
$files_to_take[] = 'twitter.json';
$files_to_take[] = 'faq.json';
$files_to_take[] = 'macro_response';
$files_to_take[] = 'macro_trace';
$files_to_take[] = 'macro_status.json';
foreach ($files as $file) {
$file_date = get_file_info($directory . $file, 'date')['date'];
$diff = $now - $file_date;
$diff_min = $diff / 60;
$diff_hour = $diff_min / 60;
$diff_days = $diff_hour / 24;
switch ($mode) {
case 'min':
$remove = $diff_min > $max;
break;
case 'hour':
$remove = $diff_hour > $max;
break;
case 'day':
$remove = $diff_days > $max;
break;
}
if ($remove && !in_array($file, $files_to_take)) {
unlink($directory . $file);
}
}
}