本文整理汇总了PHP中file::name方法的典型用法代码示例。如果您正苦于以下问题:PHP file::name方法的具体用法?PHP file::name怎么用?PHP file::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file
的用法示例。
在下文中一共展示了file::name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawPage
static function drawPage($fname = '', $echo = true)
{
$out = '';
// auto get page
if (!strlen($fname)) {
$fname = self::getPageFname();
}
if (is_file($fname)) {
// capture output
ob_start();
include $fname;
$out = ob_get_contents();
ob_end_clean();
// capture output by calling think, draw
if (!strlen($out)) {
$className = 'page' . ucfirst(file::name($fname));
if (class_exists($className, false)) {
ob_start();
$p = new $className();
$p->think();
$out = $p->draw($echo);
$out .= ob_get_contents();
ob_end_clean();
}
}
}
return $out;
}
示例2: getBody
/**
* Get the body content
*
* @param string|null $headers Header to edit or null to add the header in the email
* @return string
*/
protected function getBody(&$headers = null)
{
$body = null;
//$text = $this->quotePrintable($this->cfg->text);
$text = $this->cfg->text;
if ($this->cfg->html) {
if (empty($this->cfg->text)) {
//$text = $this->quotePrintable(utils::html2Text($this->cfg->html));
$text = utils::html2Text($this->cfg->html);
}
$boundary = '------------' . $this->getBoundary();
if ($headers) {
$headers .= $this->headerLine('Content-Type', 'multipart/alternative;' . $this->cfg->crlf . ' boundary="' . $boundary . '"');
//$headers.= $this->textLine(' boundary="'.$boundary.'"');
} else {
$body .= $this->headerLine('Content-Type', 'multipart/alternative;' . $this->cfg->crlf . ' boundary="' . $boundary . '"');
//$body.= $this->textLine(' boundary="'.$boundary.'"');
$body .= $this->textLine('');
}
// Text part
$body .= $this->textLine('This is a multi-part message in MIME format.');
$body .= $this->textLine('--' . $boundary);
}
$body .= $this->headerLine('Content-Type', 'text/plain; charset=' . $this->cfg->charset);
//$body.= $this->textLine(' charset="'.$this->cfg->charset.'"');
$body .= $this->headerLine('Content-Transfer-Encoding', $this->cfg->encoding);
//$body.= $this->headerLine('Content-Disposition', 'inline');
$body .= $this->textLine(null);
$body .= $this->textLine($this->encode($this->wrapText($text)));
if ($this->cfg->html) {
// HTML part
$body .= $this->textLine('--' . $boundary);
$html = $this->cfg->html;
$inlineImages = false;
if ($this->cfg->htmlInlineImage) {
$rootUri = request::get('rootUri');
preg_match_all('@src="(' . $rootUri . '|/)(.+)"@siU', $html, $matches);
if (!empty($matches)) {
$images = array_unique($matches[2]);
$inlineImages = array();
$i = 1;
foreach ($images as $img) {
if (file::webExists($img)) {
$file = WEBROOT . str_replace('/', DS, $img);
$cid = 'part' . $i . '.' . $this->getBoundary(16) . '@' . $this->cfg->serverName;
$inlineImages[] = array('cid' => $cid, 'file' => $file, 'name' => file::name($file), 'type' => file::getType($file));
$i++;
$html = preg_replace('@src="(' . $rootUri . '|/)(' . $img . ')"@siU', 'src="cid:' . $cid . '"', $html);
}
}
}
}
if (!empty($inlineImages)) {
$boundaryRel = '------------' . $this->getBoundary();
$body .= $this->headerLine('Content-Type', 'multipart/related;' . $this->cfg->crlf . ' boundary="' . $boundaryRel . '"');
//$body.= $this->textLine(' boundary="'.$boundaryRel.'"');
$body .= $this->textLine(null);
$body .= $this->textLine(null);
$body .= $this->textLine('--' . $boundaryRel);
}
$body .= $this->headerLine('Content-Type', 'text/html; charset=' . $this->cfg->charset . '');
//$body.= $this->textLine(' charset="'.$this->cfg->charset.'"');
$body .= $this->headerLine('Content-Transfer-Encoding', $this->cfg->encoding);
//$body.= $this->headerLine('Content-Disposition', 'inline');
$body .= $this->textLine(null);
//$body.= $this->textLine($this->quotePrintable($html));
$body .= $this->textLine($this->encode($this->wrapText($html)));
if (!empty($inlineImages)) {
foreach ($inlineImages as $img) {
$body .= $this->textLine('--' . $boundaryRel);
$body .= $this->headerLine('Content-Type', $img['type']);
//.'; name="'.$img['name'].'"');
$body .= $this->headerLine('Content-Transfer-Encoding', $this->cfg->fileEncoding);
$body .= $this->headerLine('Content-ID', '<' . $img['cid'] . '>');
//$body.= $this->headerLine('Content-Disposition', 'inline; filename="'.$img['name'].'"');
$body .= $this->textLine(null);
$body .= $this->encode(file::read($img['file']), $this->cfg->fileEncoding);
}
$body .= $this->textLine('--' . $boundaryRel . '--');
$body .= $this->textLine(null);
}
$body .= '--' . $boundary . '--';
}
return $body;
}
示例3: move
/**
* 文件移动
*
* @param string $file 文件路径
* @param string $path 新文件位置,不包含文件名称
*
* @return bool
* @since 0.1
*/
public static function move($file, $path)
{
$file = path::decode($file);
$name = file::name($file);
$target = $path . DS . $name;
//检查文件是否允许读写
if (!is_readable($file) && !is_writable($file)) {
zotop::error(zotop::t('未能找到原文件'));
}
//移动文件
if (!@rename($file, $target)) {
zotop::error(zotop::t('移动失败'));
return false;
}
return false;
}
示例4: function
<?php
$this->header();
$this->top();
$this->navbar();
?>
<script type="text/javascript">
zotop.form.callback = function(msg,$form){
zotop.msg.show(msg);
if( msg.type == 'success' ){
dialog.opener.location.reload();
dialog.close();
return true;
}
return false;
}
</script>
<style type="text/css">
body.dialog {width:530px;}
body.dialog .form-body{padding:30px 0px;}
body.dialog table.field{background:none;}
body.dialog table.field td.field-side{width:80px;}
</style>
<?php
form::header(array('icon' => 'newfile', 'title' => zotop::t('重命名模板'), 'description' => zotop::t('请输入一个新的文件名称,名称不能包含中文以及字符:<b>\\/:*?"<>|</b>')));
form::field(array('type' => 'hidden', 'name' => 'name', 'label' => zotop::t('原名称'), 'value' => file::name($file), 'valid' => 'required:true'));
form::field(array('type' => 'text', 'name' => 'newname', 'label' => zotop::t('新名称'), 'value' => file::name($file), 'valid' => 'required:true', 'description' => zotop::t('名称不能包含中文以及字符:<b>\\/:*?"<>|</b>')));
form::buttons(array('type' => 'submit', 'value' => zotop::t('保存')), array('type' => 'button', 'value' => zotop::t('关闭'), 'class' => 'zotop-dialog-close'));
form::footer();
$this->bottom();
$this->footer();
示例5: file_name
/**
* 取文件名 返回类似 1.jpg
*
*
* @param string $name
* @return string
*/
function file_name($name)
{
return file::name($name);
}