• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_file_info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了get_file_info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:simple-gifts,项目名称:Delightful-Labor,代码行数:29,代码来源:validate_custom_verification_helper.php


示例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');
     }
 }
开发者ID:git-ecorise,项目名称:ctshop,代码行数:12,代码来源:MY_Controller.php


示例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;
     }
 }
开发者ID:urangawak,项目名称:cilangeditor,代码行数:9,代码来源:system_helper.php


示例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');
     }
 }
开发者ID:git-ecorise,项目名称:ctshop,代码行数:10,代码来源:install.php


示例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);
     }
 }
开发者ID:ishawge,项目名称:No-CMS,代码行数:11,代码来源:file_helper_test.php


示例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);
 }
开发者ID:simple-gifts,项目名称:Delightful-Labor,代码行数:15,代码来源:minstall_db.php


示例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;
        }
    }
}
开发者ID:phi314,项目名称:onix,代码行数:15,代码来源:show_helper.php


示例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;
 }
开发者ID:NaszvadiG,项目名称:codeigniter-list-unused-functions,代码行数:21,代码来源:code_review.php


示例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;
 }
开发者ID:BGCX067,项目名称:fabrica-pinheiro-svn-to-git,代码行数:45,代码来源:imagem_helper.php


示例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;
     }
 }
开发者ID:k-site,项目名称:k-cms,代码行数:19,代码来源:Html.php


示例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';
}
开发者ID:RiJo,项目名称:m3uer,代码行数:18,代码来源:playlist.php


示例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;
 }
开发者ID:cristminix,项目名称:c2V0dQ-,代码行数:19,代码来源:page_berkas.php


示例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/>';
 }
开发者ID:yunkaiyueming,项目名称:ci_cms,代码行数:40,代码来源:Helper_file_test.php


示例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);
 }
开发者ID:pondyond,项目名称:x6cms,代码行数:40,代码来源:template.php


示例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);
        }
    }
}
开发者ID:tjankovic,项目名称:FAB-UI,代码行数:40,代码来源:ft_file_helper.php


示例16: download

 /**
  * @brief 下载文件,默认在 UPLOAD 文件夹下
  *
  * @param string $file
  * @param string $path 设定路径,默认为false
  *
  * @return 
  */
 public function download($file, $path = false)
 {
     if ($file) {
         if ($path) {
             $file = $path . $file;
         } else {
             $file = UPLOAD_PATH . $file;
         }
     } else {
         return false;
     }
     if (!file_exists($file)) {
         return false;
     }
     if (!function_exists('get_mime_by_extension')) {
         $CI =& get_instance();
         $CI->load->helper('file');
     }
     if ($type = get_mime_by_extension($file)) {
         $file_info = get_file_info($file);
         // ob_start();
         // ini_set('memory_limit','1200M');
         // set_time_limit(900);
         // // required for IE, otherwise Content-disposition is ignored
         // if(ini_get('zlib.output_compression'))
         //     ini_set('zlib.output_compression', 'Off');
         header("Content-Type:" . $type);
         header('Content-Disposition:attachment;filename=' . $file_info['name']);
         header('Content-Transfer-Encodeing: binary');
         header('Content-Length:' . $file_info['size']);
         // ob_clean();
         // flush();
         readfile($file);
         exit;
     } else {
         log_message('debug', 'class download: can\'t find the file type');
         return false;
     }
 }
开发者ID:PoppyLi,项目名称:PCMS,代码行数:47,代码来源:Downloads.php


示例17: get_content

 /**
  * Takes a given path and prints the content in json format.
  */
 public static function get_content($app, $path)
 {
     $path = __DIR__ . '/../data/' . $path;
     $path = rtrim($path, '/');
     require_once __DIR__ . '/helper.php';
     // get dir content
     $files = array();
     $folders = array();
     list_dir($path, $files, $folders);
     $files = array_merge($folders, $files);
     // get info
     foreach ($files as $k => $v) {
         $i = get_file_info($v['path'], array('name', 'size', 'date', 'fileperms'));
         if ($v['folder']) {
             $files[$k] = array('name' => $i['name'], 'size' => '---', 'date' => date('Y-m-d H:i:s', $i['date']), 'perm' => unix_perm_string($i['fileperms']), 'folder' => True);
         } else {
             $files[$k] = array('name' => $i['name'], 'size' => human_filesize($i['size']), 'date' => date('Y-m-d H:i:s', $i['date']), 'perm' => unix_perm_string($i['fileperms']), 'folder' => False);
         }
         $files[$k]['link'] = str_replace(__DIR__ . '/../data/', '', $v['path']);
     }
     return json_encode(array('status' => 'ok', 'files' => $files));
 }
开发者ID:semplon,项目名称:MinimalFileManager,代码行数:25,代码来源:FileManager.php


示例18: _form_vars

 public function _form_vars($id = NULL, $fields = NULL, $log_to_recent = TRUE, $display_normal_submit_cancel = TRUE)
 {
     $vars = parent::_form_vars($id, $fields, $log_to_recent, $display_normal_submit_cancel);
     $saved = $vars['data'];
     $import_view = FALSE;
     $warning_window = '';
     if (!empty($saved['name'])) {
         $view_twin = APPPATH . 'views/_blocks/' . $saved['name'] . EXT;
         if (file_exists($view_twin)) {
             $this->load->helper('file');
             $view_twin_info = get_file_info($view_twin);
             if (!empty($saved)) {
                 $tz = date('T');
                 if ($view_twin_info['date'] > strtotime($saved['last_modified'] . ' ' . $tz) or $saved['last_modified'] == $saved['date_added'] and !$this->input->get('uploaded')) {
                     $warning_window = lang('blocks_updated_view', $view_twin);
                 }
             }
         }
     }
     $vars['warning_window'] = $warning_window;
     return $vars;
 }
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:22,代码来源:blocks.php


示例19: import_view

 function import_view()
 {
     $out = 'error';
     if ($this->input->post('id')) {
         $block_data = $this->model->find_by_key($this->input->post('id'), 'array');
         $this->load->helper('file');
         $view_twin = APPPATH . 'views/_blocks/' . $block_data['name'] . EXT;
         if (file_exists($view_twin)) {
             $view_twin_info = get_file_info($view_twin);
             $tz = date('T');
             if ($view_twin_info['date'] > strtotime($block_data['last_modified'] . ' ' . $tz) or $block_data['last_modified'] == $block_data['date_added']) {
                 // must have content in order to not return error
                 $out = file_get_contents($view_twin);
                 // replace PHP tags with template tags... comments are replaced because of xss_clean()
                 if ($this->sanitize_input) {
                     $out = php_to_template_syntax($out);
                 }
             }
         }
     }
     $this->output->set_output($out);
 }
开发者ID:randombrad,项目名称:FUEL-CMS,代码行数:22,代码来源:blocks.php


示例20: getDirectoryFiles

 function getDirectoryFiles($path, $sortby = "name", $sign = "+")
 {
     $path = rtrim($path, "/") . "/";
     $this->load->helper("directory");
     $this->load->helper("file");
     $dir_ary = directory_map($path, TRUE);
     $file_attr_arr = array('name', 'size', 'date', 'mtime', 'type', 'mime', 'md5');
     $files_arr = array();
     foreach ($dir_ary as $file) {
         $tmp_arr = get_file_info($path . $file, $file_attr_arr);
         $addmd5 = $sortby == "mime" ? "_{$tmp_arr['md5']}" : "";
         $files_arr[$tmp_arr[$sortby] . $addmd5] = get_file_info($path . $file, $file_attr_arr);
     }
     if ($sign == "-") {
         krsort($files_arr);
     } else {
         ksort($files_arr);
     }
     foreach ($files_arr as $f_arr) {
         $ordered_arr[] = $f_arr;
     }
     return $ordered_arr;
 }
开发者ID:hoogle,项目名称:ttt,代码行数:23,代码来源:api.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_file_loc函数代码示例发布时间:2022-05-15
下一篇:
PHP get_file_extension函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap