本文整理汇总了PHP中Files::delFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::delFile方法的具体用法?PHP Files::delFile怎么用?PHP Files::delFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Files
的用法示例。
在下文中一共展示了Files::delFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _delFile
/**
* Delete the relative file, and any thumbnails.
* @param string $relative the relative file.
* @return boolean true if deleted, false otherwise.
*/
function _delFile($relative)
{
$fullpath = Files::makeFile($this->getImagesDir(), $relative);
//check that the file is an image
if ($this->config['validate_images'] == true) {
if (!is_array($this->getImageInfo($fullpath))) {
return false;
}
//hmmm not an Image!!???
}
$thumbnail = $this->getThumbName($fullpath);
if (Files::delFile($fullpath)) {
return Files::delFile($thumbnail);
} else {
return false;
}
}
示例2: cleanUp
/**
* Delete any tmp image files.
* @param string $path the full path
* where the clean should take place.
*/
function cleanUp($path, $file)
{
$path = Files::fixPath($path);
if (!is_dir($path)) {
return false;
}
$d = @dir($path);
$tmp = $this->manager->getTmpPrefix();
$tmpLen = strlen($tmp);
$prefix = $tmp . $this->_uid;
$len = strlen($prefix);
while (false !== ($entry = $d->read())) {
//echo $entry."<br>";
if (is_file($path . $entry) && $this->manager->isTmpFile($entry)) {
if (substr($entry, 0, $len) == $prefix && $entry != $file) {
Files::delFile($path . $entry);
} else {
if (substr($entry, 0, $tmpLen) == $tmp && $entry != $file) {
if (filemtime($path . $entry) + $this->lapse_time < time()) {
Files::delFile($path . $entry);
}
}
}
}
}
$d->close();
}
示例3: delFolder
/**
* Delete folder(s), can delete recursively.
* @param string $folder the folder to be deleted.
* @param boolean $recursive if true, all files and sub-directories
* are delete. If false, tries to delete the folder, can throw
* error if the directory is not empty.
* @return boolean true if deleted.
*/
function delFolder($folder, $recursive = false)
{
$deleted = true;
if ($recursive) {
$d = dir($folder);
while (false !== ($entry = $d->read())) {
if ($entry != '.' && $entry != '..') {
$obj = Files::fixPath($folder) . $entry;
//var_dump($obj);
if (is_file($obj)) {
$deleted &= Files::delFile($obj);
} else {
if (is_dir($obj)) {
$deleted &= Files::delFolder($obj, $recursive);
}
}
}
}
$d->close();
}
//$folder= $folder.'/thumbs';
//var_dump($folder);
if (is_dir($folder)) {
$deleted &= rmdir($folder);
} else {
$deleted &= false;
}
return $deleted;
}
示例4: processRenames
/**
* Renames files if certain GET variables are set
* @return bool
*/
function processRenames()
{
if (!empty($_GET['rename']) && !empty($_GET['renameTo'])) {
// new file name (without path and extension)
$newName = Files::escape(rawurldecode($_GET['renameTo']));
$newName = str_replace('.', '', $newName);
// path to file (from base images directory)
$oldName = rawurldecode($_GET['rename']);
// strip parent dir ("..") to avoid escaping from base directiory
$oldName = preg_replace('#\\.\\.#', '', $oldName);
if (is_dir($oldPath = Files::makeFile($this->getImagesDir(), $_GET['dir'] . $oldName))) {
$newPath = Files::makeFile($this->getImagesDir(), $_GET['dir'] . $newName);
return Files::rename($oldPath, $newPath);
} else {
// path to old file
$oldPath = Files::makeFile($this->getImagesDir(), $oldName);
$ret = Files::renameFile($oldPath, $newName);
if ($ret === true) {
// delete old thumbnail
Files::delFile($this->getThumbname($oldPath));
}
}
return $ret;
}
return null;
}
示例5: _delFile
/**
* Delete the relative file, and any thumbnails.
* @param string $relative the relative file.
* @return boolean true if deleted, false otherwise.
*/
function _delFile($relative)
{
$fullpath = Files::makeFile($this->getBaseDir(), $relative);
//check that the file is an image
if ($this->config['validate_images']) {
if (!is_array($this->getImageInfo($fullpath))) {
return false;
}
//hmmm not an Image!!???
}
$thumbnail = $this->getThumbName($fullpath);
if (Files::delFile($fullpath)) {
//deleting from the DB
global $_course;
if (isset($_course) && !empty($_course) && isset($_course['code'])) {
$document_path = substr($fullpath, strpos($fullpath, '/document/') + 9, strlen($fullpath));
// /shared_folder/4/name
DocumentManager::delete_document($_course, $document_path, $fullpath);
}
return Files::delFile($thumbnail);
} else {
return false;
}
}
示例6: Session
<?php
require_once '../classes/Autoload.php';
$session = new Session();
if ($session->isLoggeg()) {
$cancion = new Cancion(Request::get('c'));
var_dump($cancion);
if ($cancion != null) {
$rutaCan = "../canciones/" . $cancion->getNombre();
$rutaImg = "../caratulas/" . $cancion->getImagen();
Files::delFile($rutaCan);
if (is_file($rutaImg) && Files::getFileName($rutaCan) === Files::getFileName($rutaImg)) {
Files::delFile($rutaImg);
}
}
}
Utils::redirect();