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


PHP SplFileObject::getPath方法代码示例

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


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

示例1: test

function test($name, $lc, $lp)
{
    static $i = 0;
    echo "==={$i}===\n";
    $i++;
    $o = new SplFileInfo($name);
    var_dump($o);
    $c = clone $o;
    var_dump($c);
    var_dump($o === $c);
    var_dump($o == $c);
    var_dump($o->getPathname() == $c->getPathname());
    try {
        $f = new SplFileObject($name);
        var_dump($name);
        var_dump($f->getPathName());
        $l = substr($f->getPathName(), -1);
        var_dump($l != '/' && $l != '\\' && $l == $lc);
        var_dump($f->getFileName());
        $l = substr($f->getFileName(), -1);
        var_dump($l != '/' && $l != '\\' && $l == $lc);
        var_dump($f->getPath());
        $l = substr($f->getPath(), -1);
        var_dump($l != '/' && $l != '\\' && $l == $lp);
    } catch (LogicException $e) {
        echo "LogicException: " . $e->getMessage() . "\n";
    }
    try {
        $fo = $o->openFile();
        var_dump($fo->getPathName(), $fo->getFileName(), $fo->getPath());
    } catch (LogicException $e) {
        echo "LogicException: " . $e->getMessage() . "\n";
    }
}
开发者ID:gleamingthecube,项目名称:php,代码行数:34,代码来源:ext_spl_tests_fileobject_003.php

示例2: __construct

 /**
  * Constructor
  *
  * @param \SplFileObject $post Post source file
  */
 public function __construct(\SplFileObject $post)
 {
     $this->source = $post;
     if (!preg_match('/[\\d]{4}\\/[\\d]{2}\\/(.+)$/', $post->getPathname())) {
         throw new \Exception(sprintf('%s is not a valid post', $post->getPathname()));
     }
     $paths = explode(DIRECTORY_SEPARATOR, $post->getPath());
     $this->month = $paths[count($paths) - 1];
     $this->year = $paths[count($paths) - 2];
     $this->slug = $post->getBasename('.' . $post->getExtension());
 }
开发者ID:jeremyharris,项目名称:build,代码行数:16,代码来源:Post.php

示例3: getFilename

 /**
  * @return string
  */
 public function getFilename()
 {
     return $this->movieFile->getPath() . DIRECTORY_SEPARATOR . $this->movieFile->getBasename();
 }
开发者ID:mihaeu,项目名称:sub-collector,代码行数:7,代码来源:File.php

示例4: SplFileObject

<?php

set_include_path('tests');
chdir(dirname(dirname(__FILE__)));
// ext/spl
$fo = new SplFileObject('fileobject_004.phpt', 'r', true);
var_dump($fo->getPath());
var_dump($fo->getFilename());
var_dump($fo->getRealPath());
?>
==DONE==
开发者ID:badlamer,项目名称:hhvm,代码行数:11,代码来源:fileobject_004.php

示例5: compileLess

 /**
  * Compiles all required resources for the passed shop and template.
  * The function compiles all theme and plugin less files and
  * compresses the theme and plugin javascript and css files
  * into one file.
  *
  * @param $timestamp
  * @param Shop\Template $template
  * @param Shop\Shop $shop
  * @throws \Exception
  */
 public function compileLess($timestamp, Shop\Template $template, Shop\Shop $shop)
 {
     if ($shop->getMain()) {
         $shop = $shop->getMain();
     }
     $file = $this->pathResolver->getCssFilePath($shop, $timestamp);
     $file = new \SplFileObject($file, "a");
     if (!$file->flock(LOCK_EX)) {
         return;
     }
     $file->ftruncate(0);
     $this->compiler->setConfiguration($this->getCompilerConfiguration($shop));
     $config = $this->getConfig($template, $shop);
     $this->compiler->setVariables($config);
     $definitions = $this->collectLessDefinitions($template, $shop);
     foreach ($definitions as $definition) {
         $this->compileLessDefinition($shop, $definition);
     }
     $css = $this->compiler->get();
     $this->compiler->reset();
     $success = $file->fwrite($css);
     if ($success === null) {
         throw new \RuntimeException("Could not write to " . $file->getPath());
     }
     $file->flock(LOCK_UN);
     // release the lock
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:38,代码来源:Compiler.php


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