本文整理汇总了PHP中Path::real方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::real方法的具体用法?PHP Path::real怎么用?PHP Path::real使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::real方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseAll
protected function parseAll()
{
$d = dir(Path::real('css'));
while (false !== ($file = $d->read())) {
if (strncmp($file, '.', 1) != 0) {
$filename = Path::rawjoin(array($d->path, $file));
if (is_readable($filename)) {
$this->css[$filename] = $this->parse(file_get_contents($filename));
}
}
}
$d->close();
}
示例2: open
/**
* Read file and assign properties.
*
* If $width and $height are not null, and $exact:
* - is true: if image dimensions are other then $width x $height, raise
* CETypeError;
* - is false: propportional scale image to specified dimensions.
*
* $width or $height can be false ({@link Image::scaleProp() more}).
*
* @param string $fname filename to read
* @param mixed $width
* @param mixed $height
* @param boolean $exact
*
* @return mixed
* @throws CEFileSystemError ({@link CEFileSystemError description})
* @throws CETypeError ({@link CETypeError description})
*
* @access public
*/
public function open($fname, $width = null, $height = null, $exact = true)
{
$fname = Path::real($fname);
if (!file_exists($fname) || !is_readable($fname)) {
throw new CEFileSystemError(sprintf('Cannot read "%s".', $fname), 100);
}
$dst = imagecreatefromstring(file_get_contents($fname));
$this->swap($dst);
if (!is_null($width) && !is_null($height)) {
if (false === $width && false === $height) {
throw new CETypeError('Both values: $max_width and $max_height ' . 'cannot be false', 200);
}
if ($exact) {
// if image has other dimensions then specified
if (false !== $width && $width != $this->width || false !== $height && $height != $this->height) {
throw new CETypeError(sprintf('Specified image (%s) has ' . 'dimensions different then %dx%d.', $fname, $width, $height), 201);
}
} else {
return $this->scaleProp($width, $height, 'ffffff', false, 'c', 0);
}
}
return true;
}
示例3: real_with_array
public function real_with_array()
{
$folder = $this->existingFolder();
$this->assertEquals($folder->path, Path::real([$folder->path, '.', $folder->dirname, '..'])->toString());
}
示例4: walk
/**
* Recursive walk into directory and return it's content.
*
* @param string $dir directory to scan
* @param boolean $assoc return associative or normal array
* @param integer $maxLevel how deep scan $dir
*
* @return array
* @throws CENotFound ({@link CENotFound description})
*
* @access public
*/
public static function walk($dir, $assoc = false, $maxLevel = false, $curLevel = 1)
{
$dir = Path::real($dir);
$ret = array();
$data = Path::listdir($dir, self::SORT_ASC, true);
if ($assoc) {
$ret[$dir] = array('dirs' => $data['dirs'], 'files' => $data['files']);
} else {
$ret[] = array($dir, $data['dirs'], $data['files']);
}
if (false === $maxLevel || $maxLevel > $curLevel) {
foreach ($data['dirs'] as $d) {
$path = Path::join($dir, $d);
$ret = array_merge($ret, Path::walk($path, $assoc, $maxLevel, $curLevel + 1));
}
}
return $ret;
}
示例5: array
<?php
include_once Path::real('inc/web.php');
include_once Path::real('inc/db.php');
include_once Path::real('inc/cookies.php');
include_once Path::real('inc/json.php');
Db::open($dbConfig);
$config = array();
if ($data = Db::query('SELECT * FROM config')) {
$config = array_merge($config, $data);
}
ini_set('session.cookie_domain', strpos($_SERVER['HTTP_HOST'], '.') !== false ? $_SERVER['HTTP_HOST'] : '');
ini_set('session.cookie_path', '/');
示例6: array
<?php
$urls = array('hello/(.*)/' => 'HelloWorld', 'hello/' => 'HelloWorld', 'api/(.*)/' => 'Api', '\\+/(.*)/' => 'Css', '\\+/' => 'Css', '@@/(.*)/' => 'Icon', '\\*/(.*)/' => 'JavaScript', '\\*/' => 'JavaScript', '(nocookies)/' => 'Html', '(nobrowser)/' => 'Html', '(i3t)/' => 'Html', '(login)/' => 'Html', '' => 'Html');
include_once 'inc/path.php';
Path::$path = realpath(dirname(__FILE__));
include_once Path::real('config.php');
include_once Path::real('inc/common.php');
Web::dispatch($urls);