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


PHP is_file函数代码示例

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


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

示例1: qqwb_env

function qqwb_env()
{
    $msgs = array();
    $files = array(ROOT_PATH . 'include/ext/qqwb/qqoauth.php', ROOT_PATH . 'include/ext/qqwb/oauth.php', ROOT_PATH . 'modules/qqwb.mod.php');
    foreach ($files as $f) {
        if (!is_file($f)) {
            $msgs[] = "文件<b>{$f}</b>不存在";
        }
    }
    $funcs = array('version_compare', array('fsockopen', 'pfsockopen'), 'preg_replace', array('iconv', 'mb_convert_encoding'), array("hash_hmac", "mhash"));
    foreach ($funcs as $func) {
        if (!is_array($func)) {
            if (!function_exists($func)) {
                $msgs[] = "函数<b>{$func}</b>不可用";
            }
        } else {
            $t = false;
            foreach ($func as $f) {
                if (function_exists($f)) {
                    $t = true;
                    break;
                }
            }
            if (!$t) {
                $msgs[] = "函数<b>" . implode(" , ", $func) . "</b>都不可用";
            }
        }
    }
    return $msgs;
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:30,代码来源:qqwb_env.func.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = $input->getArgument('path');
     if (!file_exists($path)) {
         $output->writeln("{$path} is not a file or a path");
     }
     $filePaths = [];
     if (is_file($path)) {
         $filePaths = [realpath($path)];
     } elseif (is_dir($path)) {
         $filePaths = array_diff(scandir($path), array('..', '.'));
     } else {
         $output->writeln("{$path} is not known.");
     }
     $generator = new StopwordGenerator($filePaths);
     if ($input->getArgument('type') === 'json') {
         echo json_encode($this->toArray($generator->getStopwords()), JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE);
         echo json_last_error_msg();
         die;
         $output->write(json_encode($this->toArray($generator->getStopwords())));
     } else {
         $stopwords = $generator->getStopwords();
         $stdout = fopen('php://stdout', 'w');
         echo 'token,freq' . PHP_EOL;
         foreach ($stopwords as $token => $freq) {
             fputcsv($stdout, [utf8_encode($token), $freq]) . PHP_EOL;
         }
         fclose($stdout);
     }
 }
开发者ID:yooper,项目名称:php-text-analysis,代码行数:30,代码来源:StopWordsCommand.php

示例3: onls

 function onls()
 {
     $logdir = UC_ROOT . 'data/logs/';
     $dir = opendir($logdir);
     $logs = $loglist = array();
     while ($entry = readdir($dir)) {
         if (is_file($logdir . $entry) && strpos($entry, '.php') !== FALSE) {
             $logs = array_merge($logs, file($logdir . $entry));
         }
     }
     closedir($dir);
     $logs = array_reverse($logs);
     foreach ($logs as $k => $v) {
         if (count($v = explode("\t", $v)) > 1) {
             $v[3] = $this->date($v[3]);
             $v[4] = $this->lang[$v[4]];
             $loglist[$k] = $v;
         }
     }
     $page = max(1, intval($_GET['page']));
     $start = ($page - 1) * UC_PPP;
     $num = count($loglist);
     $multipage = $this->page($num, UC_PPP, $page, 'admin.php?m=log&a=ls');
     $loglist = array_slice($loglist, $start, UC_PPP);
     $this->view->assign('loglist', $loglist);
     $this->view->assign('multipage', $multipage);
     $this->view->display('admin_log');
 }
开发者ID:tang86,项目名称:discuz-utf8,代码行数:28,代码来源:log.php

示例4: smarty_core_display_debug_console

/**
 * Smarty debug_console function plugin
 *
 * Type:     core<br>
 * Name:     display_debug_console<br>
 * Purpose:  display the javascript debug console window
 * @param array Format: null
 * @param Smarty
 */
function smarty_core_display_debug_console($params, &$smarty)
{
    // we must force compile the debug template in case the environment
    // changed between separate applications.
    if (empty($smarty->debug_tpl)) {
        // set path to debug template from SMARTY_DIR
        $smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
        if ($smarty->security && is_file($smarty->debug_tpl)) {
            $smarty->secure_dir[] = realpath($smarty->debug_tpl);
        }
        $smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
    }
    $_ldelim_orig = $smarty->left_delimiter;
    $_rdelim_orig = $smarty->right_delimiter;
    $smarty->left_delimiter = '{';
    $smarty->right_delimiter = '}';
    $_compile_id_orig = $smarty->_compile_id;
    $smarty->_compile_id = null;
    $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl);
    if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path)) {
        ob_start();
        $smarty->_include($_compile_path);
        $_results = ob_get_contents();
        ob_end_clean();
    } else {
        $_results = '';
    }
    $smarty->_compile_id = $_compile_id_orig;
    $smarty->left_delimiter = $_ldelim_orig;
    $smarty->right_delimiter = $_rdelim_orig;
    return $_results;
}
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:41,代码来源:core.display_debug_console.php

示例5: parse

 /**
  * Parses YAML into a PHP array.
  *
  * The parse method, when supplied with a YAML stream (string or file),
  * will do its best to convert YAML in a file into a PHP array.
  *
  *  Usage:
  *  <code>
  *   $array = Yaml::parse('config.yml');
  *   print_r($array);
  *  </code>
  *
  * @param string $input Path to a YAML file or a string containing YAML
  *
  * @return array The YAML converted to a PHP array
  *
  * @throws \InvalidArgumentException If the YAML is not valid
  *
  * @api
  */
 public static function parse($input)
 {
     // if input is a file, process it
     $file = '';
     if (strpos($input, "\n") === false && is_file($input)) {
         if (false === is_readable($input)) {
             throw new ParseException(sprintf('Unable to parse "%s" as the file is not readable.', $input));
         }
         $file = $input;
         if (self::$enablePhpParsing) {
             ob_start();
             $retval = (include $file);
             $content = ob_get_clean();
             // if an array is returned by the config file assume it's in plain php form else in YAML
             $input = is_array($retval) ? $retval : $content;
             // if an array is returned by the config file assume it's in plain php form else in YAML
             if (is_array($input)) {
                 return $input;
             }
         } else {
             $input = file_get_contents($file);
         }
     }
     $yaml = new Parser();
     try {
         return $yaml->parse($input);
     } catch (ParseException $e) {
         if ($file) {
             $e->setParsedFile($file);
         }
         throw $e;
     }
 }
开发者ID:QianmiHub,项目名称:crypto-js,代码行数:53,代码来源:Yaml.php

示例6: ensureConfigFile

 /**
  * Writes a default configuration file to $path if there is none
  * @param string $path
  * @param string $type
  */
 public static function ensureConfigFile($path, $type)
 {
     if (!is_file($path)) {
         $content = self::getExampleConfiguration($type);
         file_put_contents($path, $content);
     }
 }
开发者ID:dlds,项目名称:yii2-payment,代码行数:12,代码来源:InstallHelper.php

示例7: template

function template($filename, $flag = TEMPLATE_DISPLAY)
{
    global $_W;
    $source = IA_ROOT . "/web/themes/{$_W['template']}/{$filename}.html";
    $compile = IA_ROOT . "/data/tpl/web/{$_W['template']}/{$filename}.tpl.php";
    if (!is_file($source)) {
        $source = IA_ROOT . "/web/themes/default/{$filename}.html";
        $compile = IA_ROOT . "/data/tpl/web/default/{$filename}.tpl.php";
    }
    if (!is_file($source)) {
        exit("Error: template source '{$filename}' is not exist!");
    }
    if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
        template_compile($source, $compile);
    }
    switch ($flag) {
        case TEMPLATE_DISPLAY:
        default:
            extract($GLOBALS, EXTR_SKIP);
            include $compile;
            break;
        case TEMPLATE_FETCH:
            extract($GLOBALS, EXTR_SKIP);
            ob_clean();
            ob_start();
            include $compile;
            $contents = ob_get_contents();
            ob_clean();
            return $contents;
            break;
        case TEMPLATE_INCLUDEPATH:
            return $compile;
            break;
    }
}
开发者ID:legeng,项目名称:project-2,代码行数:35,代码来源:template.func.php

示例8: autoload_framework_classes

/**
 * Function used to auto load the framework classes
 * 
 * It imlements PSR-0 and PSR-4 autoloading standards
 * The required class name should be prefixed with a namespace
 * This lowercaser of the namespace should match the folder name of the class 
 * 
 * @since 1.0.0
 * @param string $class_name name of the class that needs to be included
 */
function autoload_framework_classes($class_name)
{
    error_reporting(E_ALL);
    ini_set('display_errors', true);
    ini_set('display_startup_errors', true);
    /** If the required class is in the global namespace then no need to autoload the class */
    if (strpos($class_name, "\\") === false) {
        return false;
    }
    /** The namespace seperator is replaced with directory seperator */
    $class_name = str_replace("\\", DIRECTORY_SEPARATOR, $class_name);
    /** The class name is split into namespace and short class name */
    $path_info = explode(DIRECTORY_SEPARATOR, $class_name);
    /** The namepsace is extracted */
    $namespace = implode(DIRECTORY_SEPARATOR, array_slice($path_info, 0, count($path_info) - 1));
    /** The class name is extracted */
    $class_name = $path_info[count($path_info) - 1];
    /** The namespace is converted to lower case */
    $namespace_folder = trim(strtolower($namespace), DIRECTORY_SEPARATOR);
    /** .php is added to class name */
    $class_name = $class_name . ".php";
    /** The applications folder name */
    $framework_folder_path = realpath(dirname(__FILE__));
    /** The application folder is checked for file name */
    $file_name = $framework_folder_path . DIRECTORY_SEPARATOR . $namespace_folder . DIRECTORY_SEPARATOR . $class_name;
    if (is_file($file_name)) {
        include_once $file_name;
    }
}
开发者ID:pluginscart,项目名称:Pak-PHP,代码行数:39,代码来源:autoload.php

示例9: packageDoc

 /** Constructor
  *
  * @param str name
  * @param RootDoc root
  */
 function packageDoc($name, &$root)
 {
     $this->_name = $name;
     $this->_root =& $root;
     $phpdoctor =& $root->phpdoctor();
     // parse overview file
     $packageCommentDir = $phpdoctor->getOption('packageCommentDir');
     $packageCommentFilename = strtolower(str_replace('/', '.', $this->_name)) . '.html';
     if (isset($packageCommentDir) && is_file($packageCommentDir . $packageCommentFilename)) {
         $overviewFile = $packageCommentDir . $packageCommentFilename;
     } else {
         $pos = strrpos(str_replace('\\', '/', $phpdoctor->_currentFilename), '/');
         if ($pos !== FALSE) {
             $overviewFile = substr($phpdoctor->_currentFilename, 0, $pos) . '/package.html';
         } else {
             $overviewFile = $phpdoctor->sourcePath() . $this->_name . '.html';
         }
     }
     if (is_file($overviewFile)) {
         $phpdoctor->message("\n" . 'Reading package overview file "' . $overviewFile . '".');
         if ($html = $this->getHTMLContents($overviewFile)) {
             $this->_data = $phpdoctor->processDocComment('/** ' . $html . ' */', $this->_root);
             $this->mergeData();
         }
     }
 }
开发者ID:hobodave,项目名称:phpdoctor,代码行数:31,代码来源:packageDoc.php

示例10: checkCache

 /**
 +----------------------------------------------------------
 * 检查缓存文件是否有效
 * 如果无效则需要重新编译
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @param string $tmplTemplateFile  模板文件名
 +----------------------------------------------------------
 * @return boolen
 +----------------------------------------------------------
 */
 protected function checkCache($tmplTemplateFile)
 {
     if (!C('TMPL_CACHE_ON')) {
         // 优先对配置设定检测
         return false;
     }
     $tmplCacheFile = C('CACHE_PATH') . md5($tmplTemplateFile) . C('TMPL_CACHFILE_SUFFIX');
     if (!is_file($tmplCacheFile)) {
         return false;
     } elseif (filemtime($tmplTemplateFile) > filemtime($tmplCacheFile)) {
         // 模板文件如果有更新则缓存需要更新
         return false;
     } elseif (C('TMPL_CACHE_TIME') != 0 && time() > filemtime($tmplCacheFile) + C('TMPL_CACHE_TIME')) {
         // 缓存是否在有效期
         return false;
     }
     // 开启布局模板
     if (C('LAYOUT_ON')) {
         $layoutFile = THEME_PATH . C('LAYOUT_NAME') . C('TMPL_TEMPLATE_SUFFIX');
         if (filemtime($layoutFile) > filemtime($tmplCacheFile)) {
             return false;
         }
     }
     // 缓存有效
     return true;
 }
开发者ID:yunsite,项目名称:e-tuan001-com,代码行数:38,代码来源:ParseTemplateBehavior.class.php

示例11: __set

 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case "HtmlIncludeFilePath":
             // Passed-in value is null -- use the "default" path name of file".tpl.php"
             if (!$mixValue) {
                 $strPath = realpath(substr(QApplication::$ScriptFilename, 0, strrpos(QApplication::$ScriptFilename, '.php')) . '.tpl.php');
             } else {
                 $strPath = realpath($mixValue);
             }
             // Verify File Exists, and if not, throw exception
             if (is_file($strPath)) {
                 $this->strHtmlIncludeFilePath = $strPath;
                 return $strPath;
             } else {
                 throw new QCallerException('Accompanying HTML Include File does not exist: "' . $mixValue . '"');
             }
             break;
         case "CssClass":
             try {
                 return $this->strCssClass = QType::Cast($mixValue, QType::String);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 return parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
开发者ID:kmcelhinney,项目名称:qcodo,代码行数:34,代码来源:QFormBase.class.php

示例12: bootstrap

 protected function bootstrap()
 {
     if (is_file('package.json')) {
         $this->comment(' -> Installing npm dependencies (with yarn)...');
         $this->executeCommand($this->input->getOption('sudo') ? 'sudo yarn' : 'yarn');
     }
     if (is_file('bower.json')) {
         $this->comment(' -> Installing bower dependencies...');
         $this->executeCommand('bower install');
     }
     if (is_file('composer.json')) {
         $this->comment(' -> Installing composer dependencies...');
         $this->executeCommand('composer install');
     }
     if (is_dir('storage')) {
         $this->comment(' -> Dando permissão de escrita no diretório storage...');
         $this->executeCommand('chmod -R 777 storage');
     }
     if (is_dir('app/storage')) {
         $this->comment(' -> Dando permissão de escrita no diretório storage...');
         $this->executeCommand('chmod -R 777 app/storage');
     }
     if (is_file('.env.example')) {
         $this->comment(' -> Criando o arquivo .env');
         $this->executeCommand('cp .env.example .env');
     }
 }
开发者ID:escapework,项目名称:console,代码行数:27,代码来源:CloneCommand.php

示例13: setUp

 protected function setUp()
 {
     $file = sys_get_temp_dir() . '/phinx.yml';
     if (is_file($file)) {
         unlink($file);
     }
 }
开发者ID:nguyenducduy,项目名称:haraapp,代码行数:7,代码来源:InitTest.php

示例14: entry

function entry(&$argv)
{
    if (is_file($argv[0])) {
        if (0 === substr_compare($argv[0], '.class.php', -10)) {
            $uri = realpath($argv[0]);
            if (null === ($cl = \lang\ClassLoader::getDefault()->findUri($uri))) {
                throw new \Exception('Cannot load ' . $uri . ' - not in class path');
            }
            return $cl->loadUri($uri)->literal();
        } else {
            if (0 === substr_compare($argv[0], '.xar', -4)) {
                $cl = \lang\ClassLoader::registerPath($argv[0]);
                if (!$cl->providesResource('META-INF/manifest.ini')) {
                    throw new \Exception($cl->toString() . ' does not provide a manifest');
                }
                $manifest = parse_ini_string($cl->getResource('META-INF/manifest.ini'));
                return strtr($manifest['main-class'], '.', '\\');
            } else {
                array_unshift($argv, 'eval');
                return 'xp\\runtime\\Evaluate';
            }
        }
    } else {
        return strtr($argv[0], '.', '\\');
    }
}
开发者ID:xp-runners,项目名称:main,代码行数:26,代码来源:entry.php

示例15: cimy_um_download_database

function cimy_um_download_database()
{
    global $cum_upload_path;
    if (!empty($_POST["cimy_um_filename"])) {
        if (strpos($_SERVER['HTTP_REFERER'], admin_url('users.php?page=cimy_user_manager')) !== false) {
            // not whom we are expecting? exit!
            if (!check_admin_referer('cimy_um_download', 'cimy_um_downloadnonce')) {
                return;
            }
            $cimy_um_filename = $_POST["cimy_um_filename"];
            // sanitize the file name
            $cimy_um_filename = sanitize_file_name($cimy_um_filename);
            $cimy_um_fullpath_file = $cum_upload_path . $cimy_um_filename;
            // does not exist? exit!
            if (!is_file($cimy_um_fullpath_file)) {
                return;
            }
            header("Pragma: ");
            // Leave blank for issues with IE
            header("Expires: 0");
            header('Vary: User-Agent');
            header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
            header("Content-Type: text/csv");
            header("Content-Type: application/force-download");
            header("Content-Type: application/download");
            header("Content-Disposition: attachment; filename=\"" . esc_html($cimy_um_filename) . "\";");
            // cannot use esc_url any more because prepends 'http' (doh)
            header("Content-Transfer-Encoding: binary");
            header("Content-Length: " . filesize($cimy_um_fullpath_file));
            readfile($cimy_um_fullpath_file);
            exit;
        }
    }
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:34,代码来源:cimy_user_manager.php


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