>백엔드 개발 >PHP 튜토리얼 >七牛的源代码挑刺

七牛的源代码挑刺

WBOY
WBOY원래의
2016-06-06 20:23:341238검색

https://github.com/qiniu/php-sdk/blob/master/examples/up.php
这里是七牛上传文件的源代码,截取部分如下

require_once DIR . '/../autoload.php';
use Qiniu\Auth;
use Qiniu\Storage\UploadManager;
$accessKey = 'Access_Key';
$secretKey = 'Secret_Key';
$auth = new Auth($accessKey, $secretKey);
$bucket = 'Bucket_Name';
$token = $auth->uploadToken($bucket);
$uploadMgr = new UploadManager();
// 上传文件到七牛
$filePath = './php-logo.png';
$key = 'php-logo.png';
list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath);
echo "\n====> putFile result: \n";
if ($err !== null) {

<code>var_dump($err);</code>

} else {

<code>var_dump($ret);</code>

}
?>

提几个问题
1.代码应该缩进
2.用词不当
$key = 'php-logo.png'; 这一行我感觉,不是密码的意识,密码已经在
$accessKey = 'Access_Key';
$secretKey = 'Secret_Key';
应当是文件名的意识,应当用 $fname
3.作者为何不写英语注释?
请让我来修改一下

<code>require_once __DIR__ . '/../autoload.php';
use Qiniu\Auth;
use Qiniu\Storage\UploadManager;
$accessKey = 'Access_Key';
$secretKey = 'Secret_Key';
$auth = new Auth($accessKey, $secretKey);
$bucket = 'Bucket_Name';
$token = $auth->uploadToken($bucket);
$uploadMgr = new UploadManager();
// upload file into qiniu
$filePath = './php-logo.png';
$fname = 'php-logo.png';
list($ret, $err) = $uploadMgr->putFile($token, $fname, $filePath);
echo "\n====> putFile result: \n";
if ($err !== null) {
    var_dump($err);
} else {
    var_dump($ret);
}</code>

?>

多高大上,白富美哈!!

这个问题已被关闭,原因:非技术提问的讨论型问题

回复内容:

https://github.com/qiniu/php-sdk/blob/master/examples/up.php
这里是七牛上传文件的源代码,截取部分如下

require_once DIR . '/../autoload.php';
use Qiniu\Auth;
use Qiniu\Storage\UploadManager;
$accessKey = 'Access_Key';
$secretKey = 'Secret_Key';
$auth = new Auth($accessKey, $secretKey);
$bucket = 'Bucket_Name';
$token = $auth->uploadToken($bucket);
$uploadMgr = new UploadManager();
// 上传文件到七牛
$filePath = './php-logo.png';
$key = 'php-logo.png';
list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath);
echo "\n====> putFile result: \n";
if ($err !== null) {

<code>var_dump($err);</code>

} else {

<code>var_dump($ret);</code>

}
?>

提几个问题
1.代码应该缩进
2.用词不当
$key = 'php-logo.png'; 这一行我感觉,不是密码的意识,密码已经在
$accessKey = 'Access_Key';
$secretKey = 'Secret_Key';
应当是文件名的意识,应当用 $fname
3.作者为何不写英语注释?
请让我来修改一下

<code>require_once __DIR__ . '/../autoload.php';
use Qiniu\Auth;
use Qiniu\Storage\UploadManager;
$accessKey = 'Access_Key';
$secretKey = 'Secret_Key';
$auth = new Auth($accessKey, $secretKey);
$bucket = 'Bucket_Name';
$token = $auth->uploadToken($bucket);
$uploadMgr = new UploadManager();
// upload file into qiniu
$filePath = './php-logo.png';
$fname = 'php-logo.png';
list($ret, $err) = $uploadMgr->putFile($token, $fname, $filePath);
echo "\n====> putFile result: \n";
if ($err !== null) {
    var_dump($err);
} else {
    var_dump($ret);
}</code>

?>

多高大上,白富美哈!!

题主显然工作量不饱和呀。

关键是你要问的问题是什么呢?segmentfault是个问答平台,你这个意见你应该去七牛的github项目上提issue或者上v2ex上发帖子吧?

七牛的赶紧把楼主请去当CTO,不然?

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.