Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
haishi
Overview
Overview
Details
Activity
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
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
haishi
Commits
bd451a26
Commit
bd451a26
authored
Mar 04, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
68de1b66
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
api/Library/Qiniu/Lite.php
+10
-8
No files found.
api/Library/Qiniu/Lite.php
View file @
bd451a26
...
...
@@ -19,7 +19,7 @@ class Qiniu_Lite {
* @param string $config['accessKey'] 统一的key
* @param string $config['secretKey']
* @param string $config['space_bucket'] 自定义配置的空间
* @param string $config['space_host']
* @param string $config['space_host']
*/
public
function
__construct
(
$config
=
NULL
)
{
$this
->
config
=
$config
;
...
...
@@ -43,10 +43,12 @@ class Qiniu_Lite {
}
$config
=
$this
->
config
;
$fileName
=
date
(
'YmdHis_'
,
$_SERVER
[
'REQUEST_TIME'
])
$fileName
=
date
(
'YmdHis_'
,
$_SERVER
[
'REQUEST_TIME'
])
.
md5
(
PhalApi_Tool
::
createRandStr
(
8
)
.
microtime
(
true
));
Qiniu_SetKeys
(
$config
[
'accessKey'
],
$config
[
'secretKey'
]);
var_dump
(
$config
);
die
;
$putPolicy
=
new
Qiniu_RS_PutPolicy
(
$config
[
'space_bucket'
]);
$upToken
=
$putPolicy
->
Token
(
null
);
$putExtra
=
new
Qiniu_PutExtra
();
...
...
@@ -54,7 +56,7 @@ class Qiniu_Lite {
list
(
$ret
,
$err
)
=
Qiniu_PutFile
(
$upToken
,
$fileName
,
$filePath
,
$putExtra
);
if
(
$err
!==
null
)
{
DI
()
->
logger
->
debug
(
'failed to upload file to qiniu'
,
DI
()
->
logger
->
debug
(
'failed to upload file to qiniu'
,
array
(
'Err'
=>
$err
->
Err
,
'Reqid'
=>
$err
->
Reqid
,
'Details'
=>
$err
->
Details
,
'Code'
=>
$err
->
Code
));
}
else
{
$fileUrl
=
$config
[
'space_host'
]
.
'/'
.
$fileName
;
...
...
@@ -63,20 +65,20 @@ class Qiniu_Lite {
return
$fileUrl
;
}
/**
* 获取七牛Token
* @return string 七牛Token
*/
public
function
getQiniuToken
()
{
{
$config
=
$this
->
config
;
Qiniu_SetKeys
(
$config
[
'accessKey'
],
$config
[
'secretKey'
]);
$putPolicy
=
new
Qiniu_RS_PutPolicy
(
$config
[
'space_bucket'
]);
$upToken
=
$putPolicy
->
Token
(
null
);
return
$upToken
;
return
$upToken
;
}
/**
* 获取七牛Token(方法重写)
* @return string 七牛Token
...
...
@@ -86,6 +88,6 @@ class Qiniu_Lite {
Qiniu_SetKeys
(
$accesskey
,
$secretkey
);
$putPolicy
=
new
Qiniu_RS_PutPolicy
(
$bucket
);
$upToken
=
$putPolicy
->
Token
();
return
$upToken
;
return
$upToken
;
}
}
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