Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zuiketang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
zuiketang
Commits
7405b6c4
Commit
7405b6c4
authored
Oct 17, 2016
by
杨培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qiniu 组件获取文件URL支持私有空间
parent
bef32aea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
Qiniu.php
src/common/components/Qiniu.php
+13
-3
No files found.
src/common/components/Qiniu.php
View file @
7405b6c4
...
...
@@ -35,13 +35,23 @@ class Qiniu extends Object
{
return
call_user_func_array
([
$this
,
'getUrl'
],
explode
(
':'
,
$skey
));
}
public
function
getUrl
(
$storage
,
$key
)
{
/**
* 获取实际文件访问地址
*
* @param string $storage 存储名
* @param string $key 七牛文件key
* @param int $expires 私有空间地址有效期,默认一小时
* @return string
*/
public
function
getUrl
(
$storage
,
$key
,
$expires
=
3600
)
{
if
(
!
isset
(
$this
->
storages
[
$storage
]))
{
return
$key
;
}
return
$this
->
storages
[
$storage
][
'url'
]
.
$key
;
$url
=
$this
->
storages
[
$storage
][
'url'
]
.
$key
;
return
$storage
==
'video'
?
$this
->
getAuthInstance
()
->
privateDownloadUrl
(
$url
,
$expires
)
:
$url
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment