本文整理汇总了PHP中f::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP f::exists方法的具体用法?PHP f::exists怎么用?PHP f::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类f
的用法示例。
在下文中一共展示了f::exists方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sync
/**
* Resets store if necessary to stay in sync with content file
*/
public function sync()
{
$file = $this->structure->model()->textfile();
$ageModel = f::exists($file) ? f::modified($file) : 0;
$ageStore = s::get($this->id() . '_age');
if ($ageStore < $ageModel) {
$this->reset();
$this->age = $ageModel;
} else {
$this->age = $ageStore;
}
}
示例2: check_cache
public function check_cache($type)
{
$cache_path = __DIR__ . '/../cache/' . $type . '.json';
if (\f::exists($cache_path)) {
$cache = json_decode(\f::read($cache_path, 'json'));
if ($cache->to < time()) {
return false;
} else {
return $cache->payload;
}
} else {
return false;
}
}
示例3: size
/**
* Determines the size/length of numbers, strings, arrays and files
*
* @param mixed $value
* @return int
*/
function size($value)
{
if (is_numeric($value)) {
return $value;
}
if (is_string($value)) {
return str::length(trim($value));
}
if (is_array($value)) {
return count($value);
}
if (f::exists($value)) {
return f::size($value) / 1024;
}
}
示例4: isUserAlreadyInSession
public function isUserAlreadyInSession()
{
//get full path to user's results' file (if any) in results folder
$userResultsFile = $this->resultsFolderPath . DS . $this->username . '.' . c::get('results.file.ext');
//if usre's file exists
if (f::exists($userResultsFile)) {
//add error: the username is already present in the session
$this->addError('session.fail.email.alreadyUsed');
//return true
return true;
}
//return false
return false;
}
示例5: resizeOnDemandDeleteDir
function resizeOnDemandDeleteDir($pageId)
{
$path = str_replace('/', DS, $pageId);
$root = kirby()->roots()->index() . DS . 'thumbs' . DS . $path;
// delete directory with resized images
if (f::exists($root)) {
dir::remove($root, false);
}
}
示例6: testExists
public function testExists()
{
$this->assertTrue(f::exists($this->contentFile));
}