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


PHP SplFileInfo::getFileName方法代码示例

本文整理汇总了PHP中SplFileInfo::getFileName方法的典型用法代码示例。如果您正苦于以下问题:PHP SplFileInfo::getFileName方法的具体用法?PHP SplFileInfo::getFileName怎么用?PHP SplFileInfo::getFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SplFileInfo的用法示例。


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

示例1: call

 /**
  *
  * @param SplFileInfo $file
  * @param string $path
  * @param RecursiveDirectoryIterator $iterator
  * @return boolean
  */
 public function call(\SplFileInfo $file, $path, \RecursiveDirectoryIterator $iterator)
 {
     $firstChar = substr($file->getFileName(), 0, 1);
     if (in_array($firstChar, ['.', '_'])) {
         return false;
     }
     if ($file->isDir()) {
         return true;
     }
     if (!in_array($file->getExtension(), $this->extensions)) {
         return false;
     }
     return true;
 }
开发者ID:bobbiebenton,项目名称:herbie,代码行数:21,代码来源:FileFilterCallback.php

示例2: properties

 public function properties($path)
 {
     $path = $this->preparePath($path);
     $file = new \SplFileInfo($path);
     $data['Name'] = $file->getFileName();
     $data['Type'] = $file->getType();
     $data['Size'] = $file->getSize() . ' b';
     $data['Location'] = $this->fileSystem->makePathRelative(pathinfo($file->getRealPath(), PATHINFO_DIRNAME), $this->root);
     return $data;
 }
开发者ID:hikmahtiar6,项目名称:drafterbit,代码行数:10,代码来源:Server.php

示例3: SplFileInfo

<?php

/**
 * Read file info
 * @author Bramus Van Damme <bramus.vandamme@odisee.be>
 */
$filename = __DIR__ . '/testfile.txt';
$fi = new SplFileInfo($filename);
echo '<p>The file ' . $fi->getFileName() . ' was last modified on ' . date('Y-m-d H:i:s', $fi->getMTime()) . '</p>' . PHP_EOL;
echo '<p>The file ' . $fi->getFileName() . ' is ' . ($fi->isDir() ? '' : 'not') . ' a directory</p>' . PHP_EOL;
echo '<p>The file ' . $fi->getFileName() . ' is ' . ($fi->isFile() ? '' : 'not') . ' a file</p>' . PHP_EOL;
echo '<p>The file ' . $fi->getFileName() . ' is ' . ($fi->isLink() ? '' : 'not') . ' a shortcut</p>' . PHP_EOL;
// EOF
开发者ID:Aeprox,项目名称:ws1-sws-course-materials,代码行数:13,代码来源:spl_fileproperties.php

示例4: SplFileInfo

<?php

$file = new SplFileInfo('spl_file_info.php');
print 'Nome: ' . $file->getFileName() . '<br>' . PHP_EOL;
print 'Extensão: ' . $file->getExtension() . '<br>' . PHP_EOL;
print 'Tamanho: ' . $file->getSize() . '<br>' . PHP_EOL;
print 'Caminho: ' . $file->getRealPath() . '<br>' . PHP_EOL;
print 'Tipo: ' . $file->getType() . '<br>' . PHP_EOL;
print 'Gravação: ' . $file->isWritable() . '<br>' . PHP_EOL;
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:9,代码来源:spl_file_info.php

示例5: publishFile

 /**
  * Publishes a file
  *
  * @param \SplFileInfo $file
  */
 protected function publishFile($file)
 {
     $cache = $this->getFileCache();
     $id = $this->hash($file->getRealPath());
     if (!array_key_exists($id, $cache)) {
         $fileCache = array('sha' => 'cdnManager', 'ver' => $this->startVersion, 'run' => 0);
     } else {
         $fileCache = $cache[$id];
     }
     $crc = sha1_file($file->getRealPath());
     if ($fileCache['sha'] !== $crc) {
         $this->consoleEcho("Updating ", "0;32");
         $this->consoleEcho($file->getFileName() . " \r\n", true);
         $fileCache['ver'] = $fileCache['ver'] + 1;
         $fileCache['sha'] = $crc;
         $fileCache['pub'] = $this->assetManager->publish($file->getRealPath(), false, -1, true, $fileCache['ver']);
         $fileCache['run'] = $this->timeStamp;
         $cache[$id] = $fileCache;
         $this->setFileCache($cache);
     } else {
         $this->consoleEcho("No Change ", "0;33");
         $this->consoleEcho($file->getFileName() . "\r\n");
     }
 }
开发者ID:2amigos,项目名称:yii-cdn-asset-management-library,代码行数:29,代码来源:Manager.php

示例6: internalSort

 /**
  * File/directory sorting function
  * @param SplFileInfo $a First item
  * @param SplFileInfo $b Second item
  * @return boolean
  */
 private function internalSort($a, $b)
 {
     // Compare name
     return $a->getFileName() > $b->getFileName();
 }
开发者ID:noumenia,项目名称:nyx,代码行数:11,代码来源:sortiterator.inc.php

示例7: glob

        echo 'wrote ' . $out_path . $req_uri . "\n";
    }
}
/**
 * copy php file
 */
$files = glob($pub_path . '/*');
foreach ($files as $file) {
    if (!is_file($file)) {
        continue;
    }
    $info = new \SplFileInfo($file);
    if ($info->getExtension() != 'php') {
        continue;
    }
    if ($info->getFileName() == 'index.php' || $info->getFileName() == 'phybrid_generator.php') {
        continue;
    }
    copy($file, $out_path . '/' . $info->getFileName());
    if ($debug) {
        echo 'copied ' . $file . "\n";
    }
}
/**
 * copy assets files and image files
 */
if (file_exists($pub_path . '/assets')) {
    system('cp -pfr ' . $pub_path . '/assets ' . $out_path . '/.');
    if ($debug) {
        echo "copied assets directory\n";
    }
开发者ID:centorino,项目名称:phybrid,代码行数:31,代码来源:phybrid_generator.php


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