七牛的原始碼挑刺

來源:互聯網
上載者:User
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) {

var_dump($err);

} else {

var_dump($ret);

}
?>

提幾個問題
1.代碼應該縮排
2.用詞不當
$key = 'php-logo.png'; 這一行我感覺,不是密碼的意識,密碼已經在
$accessKey = 'Access_Key';
$secretKey = 'Secret_Key';
應當是檔案名稱的意識,應當用 $fname
3.作者為何不寫英語注釋?
請讓我來修改一下

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);}

?>

多高大上,白富美哈!!

這個問題已被關閉,原因:非技術提問的討論型問題

回複內容:

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) {

var_dump($err);

} else {

var_dump($ret);

}
?>

提幾個問題
1.代碼應該縮排
2.用詞不當
$key = 'php-logo.png'; 這一行我感覺,不是密碼的意識,密碼已經在
$accessKey = 'Access_Key';
$secretKey = 'Secret_Key';
應當是檔案名稱的意識,應當用 $fname
3.作者為何不寫英語注釋?
請讓我來修改一下

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);}

?>

多高大上,白富美哈!!

題主顯然工作量不飽和呀。

關鍵是你要問的問題是什麼呢?segmentfault是個問答平台,你這個意見你應該去七牛的github項目上提issue或者上v2ex上發文章吧?

七牛的趕緊把樓主請去當CTO,不然?

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.