本文整理汇总了PHP中Filesystem::path方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::path方法的具体用法?PHP Filesystem::path怎么用?PHP Filesystem::path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filesystem
的用法示例。
在下文中一共展示了Filesystem::path方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file
/**
* Aplicar template de um arquivo único.
*
* @param $file
* @param $target
*/
public function file($file, $target)
{
// Verificar se template existe na lista
if ($this->files->exists($file) != true) {
error('Template %s não foi encontrado', $file);
}
$this->outpath = '';
$this->filters = [$target];
// Criar diretório destino
$path = $this->files->path($target);
$this->files->force($path);
// Copiar arquivo
$this->files->copy($file, $target);
return $this;
}
示例2: getStaticProperUrl
/**
* Return URL with fingerprint
* @param type $sRootPath Path from root
*/
public static function getStaticProperUrl($sRootPath)
{
$sFilePath = Filesystem::path($sRootPath);
$sFileName = Filesystem::name($sRootPath);
$sFileExtension = Filesystem::extension($sRootPath);
$sFileLastModificationDate = filemtime($sRootPath);
$sUrl = Config::get('app.url') . $sFilePath . Config::get('format.dir.slash') . $sFileName . '_' . $sFileLastModificationDate . '_.' . $sFileExtension;
return $sUrl;
}
示例3: element
public function element($element, $data = array())
{
$element_path = Filesystem::path('app/views/') . $this->elementName($element);
if (Filesystem::exists($element_path)) {
return $this->renderView($element_path, $data);
} else {
throw new MissingViewException($this->filename($element) . ' could not be found');
}
}
示例4: renderTemplate
public function renderTemplate($source, $destination, $data = array())
{
if (!Filesystem::exists($destination)) {
$view = new View();
$content = $view->renderView(Filesystem::path($source), $data);
Filesystem::write($destination, $content);
$this->log('created', $destination);
} else {
$this->log('exists', $destination);
}
}
示例5: upload
public function upload($file, $name = null, $path = '')
{
$path = Filesystem::path('public/' . $path);
if (is_null($name)) {
$name = $file['name'];
}
if ($this->validates($file)) {
if (!is_dir($path)) {
Filesystem::createDir($path, 0777);
}
if (move_uploaded_file($file['tmp_name'], $path . '/' . $name)) {
return true;
} else {
return $this->error('CantMoveFile');
}
}
return false;
}
示例6: addFiles
/**
* Adiciona arquivos ao zip
*
* @param mixed Um arquivo ou array de arquivos para serem adicionados
* @param string Diretório interno do arquivo zip. Caso não seja informado,
os arquivos serão adicionados na raiz do arquivo zip.
* @return
*/
public function addFiles($file, $path = '')
{
$path = empty($path) ? '' : trim($path, '/') . '/';
if (is_array($file)) {
foreach ($file as $f) {
$filename = $path . basename($f);
pr($filename);
$this->object->addFile(Filesystem::path($f), $filename);
}
} else {
$filename = $path . basename($file);
$this->object->addFile(Filesystem::path($file), $filename);
}
return $this;
}
示例7: save
public function save($filename)
{
$this->render();
$filename = Filesystem::path($filename);
$this->mPDF->Output($filename, 'F');
}
示例8: dsn
public function dsn()
{
return 'sqlite:' . Filesystem::path($this->config['path']);
}
示例9: forceDownload
/**
* Força o download do arquivo
*
* @version 1.0
* - Initial
*
* @param $file O nome do arquivo, relativo a /SPAGHETTI_ROOT
*/
public static function forceDownload($file)
{
$file = Filesystem::path($file);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
}