本文整理汇总了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";
}
}
示例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());
}
示例3: getFilename
/**
* @return string
*/
public function getFilename()
{
return $this->movieFile->getPath() . DIRECTORY_SEPARATOR . $this->movieFile->getBasename();
}
示例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==
示例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
}