I've been like this before. Generate seven tokens for cattle:
$bucket = ""; //你的七牛云存储的空间名称 $accessKey = ''; //公钥 $secretKey = ''; //密钥 Qiniu_SetKeys($accessKey, $secretKey); $putPolicy = new Qiniu_RS_PutPolicy($bucket); //生成token $token = $putPolicy->Token(null);
Now I want to put a little more strategy, than the size of the picture, rename the image, allow uploading of file types, and so on, I constructed such a method:
$policy= array( "scope"=>"", //存储的空间名称 "saveKey"=>"", //重命名 "fsizeLimit"=>"", //文件大小 "mimeLimit"=>"" // 文件类型");$accessKey = ''; //公钥$secretKey = ''; //密钥Qiniu_SetKeys($accessKey, $secretKey);$putPolicy = new Qiniu_RS_PutPolicy($policy);//把策略放这里//生成token$token = $putPolicy->Token(null);
Now, I have trouble, this is not generated token, and the first method, I was a successful generation of token, I would like to download the PHP JDK to deal with this problem, but it seems I did not understand, I ask who can help me?
Reply content:
I've been like this before. Generate seven tokens for cattle:
$bucket = ""; //你的七牛云存储的空间名称 $accessKey = ''; //公钥 $secretKey = ''; //密钥 Qiniu_SetKeys($accessKey, $secretKey); $putPolicy = new Qiniu_RS_PutPolicy($bucket); //生成token $token = $putPolicy->Token(null);
Now I want to put a little more strategy, than the size of the picture, rename the image, allow uploading of file types, and so on, I constructed such a method:
$policy= array( "scope"=>"", //存储的空间名称 "saveKey"=>"", //重命名 "fsizeLimit"=>"", //文件大小 "mimeLimit"=>"" // 文件类型");$accessKey = ''; //公钥$secretKey = ''; //密钥Qiniu_SetKeys($accessKey, $secretKey);$putPolicy = new Qiniu_RS_PutPolicy($policy);//把策略放这里//生成token$token = $putPolicy->Token(null);
Now, I have trouble, this is not generated token, and the first method, I was a successful generation of token, I would like to download the PHP JDK to deal with this problem, but it seems I did not understand, I ask who can help me?
Look at your code, it should be the 6.x version of the SDK, and the way to set the upload strategy is the 7.x version of the method, so there will certainly be a problem.
6.x version of the PHP SDK documentation can refer to http://developer.qiniu.com/docs/v6/sdk/legacy-php-sdk.html
In addition one modifies here as below this should be possible:
$bucket = "";$putPolicy = new Qiniu_RS_PutPolicy("$bucket");$putPolicy->SaveKey = "";$putPolicy->FsizeLimit = "";$putPolicy->MimeLimit= "";$accessKey = ''; //公钥$secretKey = ''; //密钥Qiniu_SetKeys($accessKey, $secretKey);$upToken = $putPolicy->Token(null);echo $upToken;