Skip to content
This repository was archived by the owner on Jan 4, 2020. It is now read-only.

Commit 2189bd5

Browse files
committed
Merge pull request #373 from itlong/itlong
修改BUILD_LITE_FILE 的true,false判断;修改http download兼容中文名
2 parents cdbeadb + 0314507 commit 2189bd5

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

ThinkPHP/Library/Behavior/BuildLiteBehavior.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class BuildLiteBehavior
1818
{
1919
public function run(&$params)
2020
{
21-
if (!defined('BUILD_LITE_FILE')) {
21+
if (!defined('BUILD_LITE_FILE') || BUILD_LITE_FILE == false) {
2222
return;
2323
}
2424

ThinkPHP/Library/Org/Net/Http.class.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public static function download($filename, $showname = '', $content = '', $expir
164164
if (empty($showname)) {
165165
$showname = $filename;
166166
}
167-
$showname = basename($showname);
167+
$showname = self::get_basename($showname);;
168168
if (!empty($filename)) {
169169
$finfo = new \finfo(FILEINFO_MIME);
170170
$type = $finfo->file($filename);
@@ -190,6 +190,14 @@ public static function download($filename, $showname = '', $content = '', $expir
190190
exit();
191191
}
192192

193+
/**
194+
* 获取文件的名称,兼容中文名
195+
* @return string
196+
*/
197+
static public function get_basename($filename){
198+
return preg_replace('/^.+[\\\\\\/]/', '', $filename);
199+
}
200+
193201
/**
194202
* 显示HTTP Header 信息
195203
* @return string

0 commit comments

Comments
 (0)