本文整理汇总了PHP中get_path_this函数的典型用法代码示例。如果您正苦于以下问题:PHP get_path_this函数的具体用法?PHP get_path_this怎么用?PHP get_path_this使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_path_this函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fileGet
public function fileGet()
{
$filename = _DIR($this->in['filename']);
if (!is_readable($filename)) {
show_json($this->L['no_permission_read'], false);
}
if (filesize($filename) >= 1024 * 1024 * 20) {
show_json($this->L['edit_too_big'], false);
}
$filecontents = file_get_contents($filename);
//文件内容
$charset = get_charset($filecontents);
if ($charset != '' || $charset != 'utf-8') {
$filecontents = mb_convert_encoding($filecontents, 'utf-8', $charset);
}
$data = array('ext' => get_path_ext($filename), 'name' => iconv_app(get_path_this($filename)), 'filename' => rawurldecode($this->in['filename']), 'charset' => $charset, 'content' => $filecontents);
show_json($data);
}
开发者ID:fangbei,项目名称:KODExplorer,代码行数:18,代码来源:editor.class.php
示例2: url_header
function url_header($url)
{
$name = '';
$length = 0;
$header = @get_headers($url, true);
if (!$header) {
return false;
}
if (isset($header['Content-Length'])) {
if (is_array($header['Content-Length'])) {
$length = array_pop($header['Content-Length']);
} else {
$length = $header['Content-Length'];
}
}
if (isset($header['Content-Disposition'])) {
if (is_array($header['Content-Disposition'])) {
$dis = array_pop($header['Content-Disposition']);
} else {
$dis = $header['Content-Disposition'];
}
$i = strpos($dis, "filename=");
if ($i != false) {
$name = substr($dis, $i + 9);
$name = trim($name, '"');
}
}
if (!$name) {
$name = get_path_this($url);
if (stripos($name, '?')) {
$name = substr($name, 0, stripos($name, '?'));
}
if (!$name) {
$name = 'index.html';
}
}
// $header['name'] = $name;
// return $header;
return array('length' => $length, 'name' => $name);
}
开发者ID:zhendeguoke1008,项目名称:OneShop,代码行数:40,代码来源:web.function.php
示例3: _make_file_proxy
public function _make_file_proxy($file_path)
{
if (!file_exists($file_path)) {
return '';
}
if (!$GLOBALS['is_root'] && $GLOBALS['auth']['explorer:fileDownload'] != 1) {
return '';
}
load_class('mcrypt');
$pass = $GLOBALS['config']['setting_system']['system_password'];
$fid = Mcrypt::encode($file_path, $pass, $GLOBALS['config']['settings']['download_url_time']);
//文件对外界公开的地址;有效期在user_setting.php中设定;末尾追加文件名为了kod远程下载
$file_name = urlencode(get_path_this($file_path));
return APPHOST . 'index.php?user/public_link&fid=' . $fid . '&file_name=/' . $file_name;
}
开发者ID:zxc135781,项目名称:daocloud-KODExplorer,代码行数:15,代码来源:explorer.class.php
示例4: file_put_out
/**
* 输出、文件下载
* 默认以附件方式下载;$download为false时则为输出文件
*/
function file_put_out($file, $download = false)
{
if (!is_file($file)) {
show_json('not a file!');
}
if (!file_exists($file)) {
show_json('file not exists', false);
}
if (!is_readable($file)) {
show_json('file not readable', false);
}
set_time_limit(0);
ob_clean();
//清除之前所有输出缓冲 TODO
$mime = get_file_mime(get_path_ext($file));
if ($download || strstr($mime, 'application/') && $mime != 'application/x-shockwave-flash') {
//下载或者application则设置下载头
$filename = get_path_this($file);
//解决在IE中下载时中文乱码问题
if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/Trident/', $_SERVER['HTTP_USER_AGENT'])) {
if ($GLOBALS['config']['system_os'] != 'windows') {
//win主机 ie浏览器;中文文件下载urlencode问题
$filename = str_replace('+', '%20', urlencode($filename));
}
}
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment;filename=" . $filename);
} else {
//缓存文件
header('Expires: ' . date('D, d M Y H:i:s', time() + 3600 * 24 * 20) . ' GMT');
header("Cache-Pragma: public");
header("Cache-Control: cache, must-revalidate");
if (isset($_SERVER['If-Modified-Since']) && strtotime($_SERVER['If-Modified-Since']) == filemtime($file)) {
header('HTTP/1.1 304 Not Modified');
header('Last-Modified: ' . date('D, d M Y H:i:s', filemtime($file)) . ' GMT');
//304
exit;
} else {
header('Last-Modified: ' . date('D, d M Y H:i:s', filemtime($file)) . ' GMT', true, 200);
}
$etag = '"' . md5(date('D, d M Y H:i:s', filemtime($file))) . '"';
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag) {
header('HTTP/1.1 304 Not Modified');
header('Etag: ' . $etag);
exit;
} else {
header('Etag: ' . $etag);
}
}
header("X-Powered-By: kodExplorer.");
header("Content-Type: " . $mime);
header("Accept-Ranges: bytes");
$size = get_filesize($file);
$length = $size;
// Content length
$start = 0;
// Start byte
$end = $size - 1;
// End byte
if (isset($_SERVER['HTTP_RANGE']) || isset($_GET['start'])) {
//分段请求;视频拖拽
$c_start = $start;
$c_end = $end;
if (isset($_GET['start'])) {
$c_start = intval($_GET['start']);
} else {
//range
list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
if (strpos($range, ',') !== false) {
header('HTTP/1.1 416 Requested Range Not Satisfiable');
header("Content-Range: bytes {$start}-{$end}/{$size}");
exit;
}
if ($range == '-') {
$c_start = $size - substr($range, 1);
} else {
$range = explode('-', $range);
$c_start = $range[0];
$c_end = isset($range[1]) && is_numeric($range[1]) ? $range[1] : $size;
}
$c_end = $c_end > $end ? $end : $c_end;
if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) {
header('HTTP/1.1 416 Requested Range Not Satisfiable');
header("Content-Range: bytes {$start}-{$end}/{$size}");
exit;
}
}
$start = $c_start;
$end = $c_end;
$length = $end - $start + 1;
header('HTTP/1.1 206 Partial Content');
}
header("Content-Range: bytes {$start}-{$end}/{$size}");
header("Content-Length: " . $length);
//header("X-Sendfile: $file");exit;
if (!($fp = @fopen($file, "rb"))) {
//.........这里部分代码省略.........
开发者ID:WPG,项目名称:KODExplorer,代码行数:101,代码来源:file.function.php
示例5: php_env_check
function php_env_check()
{
$L = $GLOBALS['L'];
$error = '';
$base_path = get_path_this(BASIC_PATH) . '/';
if (!function_exists('iconv')) {
$error .= '<li>' . $L['php_env_error_iconv'] . '</li>';
}
if (!function_exists('mb_convert_encoding')) {
$error .= '<li>' . $L['php_env_error_mb_string'] . '</li>';
}
if (!version_compare(PHP_VERSION, '5.0', '>=')) {
$error .= '<li>' . $L['php_env_error_version'] . '</li>';
}
if (!function_exists('file_get_contents')) {
$error .= '<li>' . $L['php_env_error_file'] . '</li>';
}
if (!path_writable(BASIC_PATH)) {
$error .= '<li>' . $base_path . ' ' . $L['php_env_error_path'] . '</li>';
}
if (!path_writable(BASIC_PATH . 'data')) {
$error .= '<li>' . $base_path . 'data ' . $L['php_env_error_path'] . '</li>';
}
if (!path_writable(BASIC_PATH . 'data/system')) {
$error .= '<li>' . $base_path . 'data/system ' . $L['php_env_error_path'] . '</li>';
}
if (!path_writable(BASIC_PATH . 'data/User')) {
$error .= '<li>' . $base_path . 'data/User ' . $L['php_env_error_path'] . '</li>';
}
if (!path_writable(BASIC_PATH . 'data/thumb')) {
$error .= '<li>' . $base_path . 'data/thumb ' . $L['php_env_error_path'] . '</li>';
}
if (!function_exists('imagecreatefromjpeg') || !function_exists('imagecreatefromgif') || !function_exists('imagecreatefrompng') || !function_exists('imagecolorallocate')) {
$error .= '<li>' . $L['php_env_error_gd'] . '</li>';
}
return $error;
}
开发者ID:ck8275411,项目名称:KODExplorer,代码行数:37,代码来源:util.php
示例6: zip
private function zip($zip_path)
{
if (!isset($zip_path)) {
show_json($this->L['share_not_download_tips'], false);
}
load_class('pclzip');
ini_set('memory_limit', '2028M');
//2G;
$zip_list = json_decode($this->in['list'], true);
$list_num = count($zip_list);
for ($i = 0; $i < $list_num; $i++) {
$zip_list[$i]['path'] = _DIR_CLEAR($this->path . $this->_clear($zip_list[$i]['path']));
}
//指定目录
if ($list_num == 1) {
$path_this_name = get_path_this($zip_list[0]['path']);
} else {
$path_this_name = get_path_this(get_path_father($zip_list[0]['path']));
}
$zipname = $zip_path . $path_this_name . '.zip';
$zipname = get_filename_auto($zipname, date(' h.i.s'));
$files = array();
for ($i = 0; $i < $list_num; $i++) {
$files[] = $zip_list[$i]['path'];
}
$remove_path_pre = get_path_father($zip_list[0]['path']);
$archive = new PclZip($zipname);
$v_list = $archive->create(implode(',', $files), PCLZIP_OPT_REMOVE_PATH, $remove_path_pre);
return iconv_app($zipname);
}
开发者ID:zhendeguoke1008,项目名称:OneShop,代码行数:30,代码来源:share.class.php
示例7: file_download
/**
* 文件下载
*/
function file_download($file)
{
if (!file_exists($file)) {
show_json('file not exists');
}
if (isset($_SERVER['HTTP_RANGE']) && $_SERVER['HTTP_RANGE'] != "" && preg_match("/^bytes=([0-9]+)-\$/i", $_SERVER['HTTP_RANGE'], $match) && $match[1] < $fsize) {
$start = $match[1];
} else {
$start = 0;
}
$size = filesize($file);
header("Cache-Control: public");
header("Content-Type: application/octet-stream");
$filename = get_path_this($file);
//解决在IE中下载时中文乱码问题
if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) {
$filename = str_replace('+', '%20', urlencode($filename));
}
header("Content-Disposition: attachment;filename=" . get_path_this($file));
if ($start > 0) {
header("HTTP/1.1 206 Partial Content");
header("Content-Length: " . ($size - $start));
header("Content-Ranges: bytes" . $start . "-" . ($size - 1) . "/" . $size);
} else {
header("Content-Length: {$size}");
header("Accept-Ranges: bytes");
}
$fp = fopen($file, "rb");
fseek($fp, $start);
while (!feof($fp)) {
set_time_limit(0);
print fread($fp, 1024 * 8);
//输出文件
flush();
ob_flush();
}
fclose($fp);
exit;
}
开发者ID:keycoolkui,项目名称:KODExplorer,代码行数:42,代码来源:file.function.php
示例8: serverDownload
public function serverDownload()
{
$uuid = 'download_' . $this->in['uuid'];
if ($this->in['type'] == 'percent') {
//获取下载进度
//show_json($_SESSION[$uuid]);
if (isset($_SESSION[$uuid])) {
$info = $_SESSION[$uuid];
$result = array('uuid' => $this->in['uuid'], 'length' => (int) $info['length'], 'size' => (int) filesize($info['path'] . '.download'), 'time' => mtime());
show_json($result);
} else {
show_json('', false);
}
} else {
if ($this->in['type'] == 'remove') {
//取消下载;文件被删掉则自动停止
del_file($_SESSION[$uuid]['path']);
unset($_SESSION[$uuid]);
show_json('', false);
}
}
//下载
$save_path = _DIR($this->in['save_path']);
if (!is_writeable($save_path)) {
show_json($this->L['no_permission_write'], false);
}
$url = rawurldecode($this->in['url']);
$header = url_header($url);
if (!$header) {
show_json($this->L['download_error_exists'], false);
}
$save_path = $save_path . urldecode($header['name']);
if (!checkExt($save_path)) {
$save_path = _DIR($this->in['save_path']) . date() . '.temp';
}
$save_path = iconv_system($save_path);
$save_path = get_filename_auto($save_path);
session_start();
$_SESSION[$uuid] = array('length' => $header['length'], 'path' => $save_path);
session_write_close();
if (file_download_this($url, $save_path)) {
$name = get_path_this(iconv_app($save_path));
show_json($this->L['download_success'], true, $name);
} else {
show_json($this->L['download_error_create'], false);
}
}
开发者ID:pony-yu,项目名称:KODExplorer,代码行数:47,代码来源:explorer.class.php
示例9: path_search
function path_search($path, $search, $is_content = false, $file_ext = '', $is_case = false)
{
$ext_arr = explode("|", $file_ext);
recursion_dir($path, $dirs, $files, -1, 0);
$strpos = 'stripos';
//是否区分大小写
if ($is_case) {
$strpos = 'strpos';
}
$filelist = array();
$folderlist = array();
foreach ($files as $f) {
$ext = get_path_ext($f);
$path_this = get_path_this($f);
if ($file_ext != '' && !in_array($ext, $ext_arr)) {
continue;
}
//文件类型不在用户限定内
if ($strpos($path_this, $search) !== false) {
//搜索文件名;搜到就返回;搜不到继续
$filelist[] = file_info($f);
continue;
}
if ($is_content && is_file($f)) {
$fp = fopen($f, "r");
$content = @fread($fp, get_filesize($f));
fclose($fp);
if ($strpos($content, iconv_app($search)) !== false) {
$filelist[] = file_info($f);
}
}
}
if ($file_ext == '') {
//没限定扩展名则才搜索文件夹
foreach ($dirs as $f) {
$path_this = get_path_this($f);
if ($strpos($path_this, $search) !== false) {
$folderlist[] = array('name' => iconv_app(get_path_this($f)), 'path' => iconv_app(get_path_father($f)));
}
}
}
return array('folderlist' => $folderlist, 'filelist' => $filelist);
}
开发者ID:kuniasahi,项目名称:mpshell,代码行数:43,代码来源:mpshell.php
示例10: unzip
public function unzip()
{
load_class('pclzip');
ini_set('memory_limit', '2028M');
//2G;
$path = $this->path;
$name = get_path_this($path);
$name = substr($name, 0, strrpos($name, '.'));
$path_father_name = get_path_father($path);
$unzip_to = $path_father_name . $path_this_name;
if (isset($this->in['path_to'])) {
//解压到指定位置
$unzip_to = _DIR($this->in['path_to']);
}
$zip = new PclZip($path);
$result = $zip->extract(PCLZIP_OPT_PATH, $unzip_to, PCLZIP_OPT_SET_CHMOD, 0777, PCLZIP_OPT_REPLACE_NEWER);
//解压到某个地方,覆盖方式
if ($result == 0) {
show_json("Error : " . $zip->errorInfo(true), fasle);
} else {
show_json($this->L['unzip_success']);
}
}
开发者ID:longmore,项目名称:KODExplorer,代码行数:23,代码来源:explorer.class.php
示例11: file_put_out
/**
* Output, file download
* Default attachment download; $ download is false when compared to the output file
*/
function file_put_out($file, $download = false)
{
if (!is_file($file)) {
show_json('not a file!');
}
set_time_limit(0);
//ob_clean();//Clear until all output buffers
if (!file_exists($file)) {
show_json('file not exists', false);
}
if (isset($_SERVER['HTTP_RANGE']) && $_SERVER['HTTP_RANGE'] != "" && preg_match("/^bytes=([0-9]+)-\$/i", $_SERVER['HTTP_RANGE'], $match) && $match[1] < $fsize) {
$start = $match[1];
} else {
$start = 0;
}
$size = get_filesize($file);
$mime = get_file_mime(get_path_ext($file));
if ($download || strstr($mime, 'application/')) {
//Download or download application is set head
$filename = get_path_this($file);
//Download IE resolve when Chinese garbage problem
if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/Trident/', $_SERVER['HTTP_USER_AGENT'])) {
if ($GLOBALS['config']['system_os'] != 'windows') {
//win the host ie browser; Chinese file download urlencode problem
$filename = str_replace('+', '%20', urlencode($filename));
}
}
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment;filename=" . $filename);
}
header("Cache-Control: public");
header("X-Powered-By: kodExplorer.");
header("Content-Type: " . $mime);
if ($start > 0) {
header("HTTP/1.1 206 Partial Content");
header("Content-Ranges: bytes" . $start . "-" . ($size - 1) . "/" . $size);
header("Content-Length: " . ($size - $start));
} else {
header("Accept-Ranges: bytes");
header("Content-Length: {$size}");
}
$fp = fopen($file, "rb");
fseek($fp, $start);
while (!feof($fp)) {
print fread($fp, 1024 * 8);
//Output File
flush();
ob_flush();
}
fclose($fp);
}
开发者ID:ajhalls,项目名称:KODExplorer,代码行数:55,代码来源:file.function.php
示例12: file_download
/**
* 文件下载
*/
function file_download($file)
{
if (file_exists($file)) {
header("Cache-Control: public");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment;filename=" . get_path_this($file));
header("Accept-Ranges: bytes");
$size = filesize($file);
//如果有$_SERVER['HTTP_RANGE']参数 断点续传
if (isset($_SERVER['HTTP_RANGE'])) {
list($a, $range) = explode("=", $_SERVER['HTTP_RANGE']);
str_replace($range, "-", $range);
$size2 = $size - 1;
//文件总字节数
$new_length = $size2 - $range;
//获取下次下载的长度
header("HTTP/1.1 206 Partial Content");
header("Content-Length: {$new_length}");
//输入总长
header("Content-Range: bytes {$range}{$size2}/{$size}");
} else {
//第一次连接
$size2 = $size - 1;
header("Content-Range: bytes 0-{$size2}/{$size}");
//Content-Range: bytes 0-4988927/4988928
header("Content-Length: " . $size);
//输出总长
}
$fp = fopen($file, "rb");
fseek($fp, $range);
while (!feof($fp)) {
set_time_limit(0);
print fread($fp, 1024 * 8);
//输出文件
flush();
ob_flush();
}
fclose($fp);
exit;
}
}
开发者ID:longmore,项目名称:KODExplorer,代码行数:44,代码来源:file.function.php
示例13: php_env_check
function php_env_check()
{
$L = $GLOBALS['L'];
$error = '';
$base_path = get_path_this(BASIC_PATH) . '/';
if (!function_exists('iconv')) {
$error .= '<li>' . $L['php_env_error_iconv'] . '</li>';
}
if (!function_exists('mb_convert_encoding')) {
$error .= '<li>' . $L['php_env_error_mb_string'] . '</li>';
}
if (!version_compare(PHP_VERSION, '5.0', '>=')) {
$error .= '<li>' . $L['php_env_error_version'] . '</li>';
}
if (!function_exists('file_get_contents')) {
$error .= '<li>' . $L['php_env_error_file'] . '</li>';
}
if (!path_writable(BASIC_PATH)) {
$error .= '<li>' . $base_path . ' ' . $L['php_env_error_path'] . '</li>';
}
if (!path_writable(BASIC_PATH . 'data')) {
$error .= '<li>' . $base_path . 'data ' . $L['php_env_error_path'] . '</li>';
}
$parent = get_path_father(BASIC_PATH);
$arr_check = array(BASIC_PATH, BASIC_PATH . 'data', BASIC_PATH . 'data/system', BASIC_PATH . 'data/User', BASIC_PATH . 'data/thumb');
foreach ($arr_check as $value) {
if (!path_writable($value)) {
$error .= '<li>' . str_replace($parent, '', $value) . '/ ' . $L['php_env_error_path'] . '</li>';
}
}
if (!function_exists('imagecreatefromjpeg') || !function_exists('imagecreatefromgif') || !function_exists('imagecreatefrompng') || !function_exists('imagecolorallocate')) {
$error .= '<li>' . $L['php_env_error_gd'] . '</li>';
}
return $error;
}
开发者ID:WPG,项目名称:KODExplorer,代码行数:35,代码来源:util.php
注:本文中的get_path_this函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论