An error occurred while downloading the private space of qiniu.

Source: Internet
Author: User
Controller publicfunctionqiniu () {$ settingC (& #039; UPLOAD_SITEIMG_QINIU & #039;); $ UploadnewThinkUpload ($ setting); dump ($ Upload); $ info $ Upload; gt; upload (); uploaded successfully $ url $ info [& #039; file & #039;] [& #039; url & #039;]; du... controller

Public function qiniu ()
{
$ Setting = C ('upload _ SITEIMG_QINIU ');
$ Upload = new \ Think \ Upload ($ setting );
// Dump ($ Upload );
$ Info = $ Upload-> upload (); // Upload successful
$ Url = $ info ['file'] ['url'];
Dump ($ url );
$ Aaa = str_replace ('HTTP :// <空间名字> .Qiniudn.com ', 'HTTP: // 7xkd4t.com1.z0.glb.clouddn.com/', $ url );
Dump ($ aaa );
Echo Qiniu_Sign ($ url );
Dump ($ info );

}

Call Method
Function Qiniu_Encode ($ str) // URLSafeBase64Encode
{
$ Find = array ('+ ','/');
$ Replace = array ('-','_');
Return str_replace ($ find, $ replace, base64_encode ($ str ));
}
Function Qiniu_Sign ($ url) {// url in $ info
$ Setting = C ('upload _ SITEIMG_QINIU ');
$ Duetime = NOW_TIME + 86400; // validity period of the downloaded credential
$ DownloadUrl = $ url .'? E = '. $ duetime;
$ Sign = hash_hmac ('sha1', $ DownloadUrl, $ setting ["driverConfig"] ["secrectKey"], true );
$ EncodedSign = Qiniu_Encode ($ Sign );
$ Token = $ setting ["driverConfig"] ["accessKey"]. ':'. $ EncodedSign;
$ RealDownloadUrl = $ DownloadUrl. '& token ='. $ Token;
Return $ RealDownloadUrl;
}

Browser access
{
"Error": "no such entry"
}

What is the situation ???

Reply content:

Controller

Public function qiniu ()
{
$ Setting = C ('upload _ SITEIMG_QINIU ');
$ Upload = new \ Think \ Upload ($ setting );
// Dump ($ Upload );
$ Info = $ Upload-> upload (); // Upload successful
$ Url = $ info ['file'] ['url'];
Dump ($ url );
$ Aaa = str_replace ('HTTP :// <空间名字> .Qiniudn.com ', 'HTTP: // 7xkd4t.com1.z0.glb.clouddn.com/', $ url );
Dump ($ aaa );
Echo Qiniu_Sign ($ url );
Dump ($ info );

}

Call Method
Function Qiniu_Encode ($ str) // URLSafeBase64Encode
{
$ Find = array ('+ ','/');
$ Replace = array ('-','_');
Return str_replace ($ find, $ replace, base64_encode ($ str ));
}
Function Qiniu_Sign ($ url) {// url in $ info
$ Setting = C ('upload _ SITEIMG_QINIU ');
$ Duetime = NOW_TIME + 86400; // validity period of the downloaded credential
$ DownloadUrl = $ url .'? E = '. $ duetime;
$ Sign = hash_hmac ('sha1', $ DownloadUrl, $ setting ["driverConfig"] ["secrectKey"], true );
$ EncodedSign = Qiniu_Encode ($ Sign );
$ Token = $ setting ["driverConfig"] ["accessKey"]. ':'. $ EncodedSign;
$ RealDownloadUrl = $ DownloadUrl. '& token ='. $ Token;
Return $ RealDownloadUrl;
}

Browser access
{
"Error": "no such entry"
}

What is the situation ???

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.