java - 七牛 取指定的空间下面的文件条目,报错
PHPz
PHPz 2017-04-18 10:26:00
0
1
1141

发现部分空间是可以
部分空间不可以,报下面的错误
{ResponseInfo:com.qiniu.http.Response@74d25d10,status:631, reqId:OUgAAEnJhJQ3MY4U, xlog:CFGG:3/612;ZONEPROXY:12/631, xvia:, adress:rsf.qbox.me/183.136.139.24:80, duration:0.000000 s, error:no such bucket}

PHPz
PHPz

学习是最好的投资!

reply all(1)
梦想无需昭告天下

<?php

/**

* Verification code category

*/

$code= new Code();

$code->outImage();

class Code

{

protected $number;

protected $codeType;

protected $width;

protected $height;

protected $image;

protected $code;

public function __construct($number=4,$codeType=2,$width=100,$height=30)

{

$this->number=$number;

$this->codeType=$codeType;

$this->width=$width;

$this->height=$height;

$this->code=$this->createCode();

}

public function __get($name){

if ($name=='code') {

return $this->code;

}else{

return false;

}

}

public function __destruct(){

imagedestroy($this->image);

}

protected function createCode(){

switch ($this->codeType) {

case '0':

$code=$this->getNumberCode();

break;

case '1':

$code=$this->getCharCode();

break;

case '2':

$code=$this->getNumberCharCode();

break;

default:

die("对不起,不支持该验证码类型!!!");

}

return $code;

}

protected function getNumberCode(){

$str=join('',range(0, 9));

return substr(str_shuffle($str), 0,$this->number);

}

protected function getCharCode(){

$str=join('',range(a, z));

$str=$str.strtoupper($str);

return substr(str_shuffle($str), 0,$this->number);

}

protected function getNumberCharCode(){

$str1=join('',range(0, 9));

$str=join('',range(a, z));

$str=$str1.$str.strtoupper($str);

return substr(str_shuffle($str), 0,$this->number);

}

public function outImage(){

$this->createImage();

$this->fillBack();

$this->drawChar();

$this->drawDistrub();

$this->show();

}

protected function createImage(){

$this->image=imagecreatetruecolor($this->width, $this->height);

}

protected function fillBack(){

imagefill($this->image, 0, 0, $this->lightColor());

}

protected function  lightColor(){

        return  imagecolorallocate($this->image, mt_rand(130,255), mt_rand(130,255), mt_rand(130,255));

}

protected function darkColor(){

return  imagecolorallocate($this->image, mt_rand(0,120), mt_rand(0,120), mt_rand(0,120));

}

protected function drawChar(){

for ($i=0; $i <$this->number; $i++) { 

$Width=$this->width/$this->number;

$x=mt_rand($i*$Width+10,($i+1)*$Width-15);

$y=mt_rand(0,$this->height-18);

imagechar($this->image, 6, $x, $y, $this->code[$i], $this->darkColor());

}

}

protected function drawDistrub(){

for ($i=0; $i < 300; $i++) { 

$x=mt_rand(0,$this->width);

$y=mt_rand(0,$this->height);

imagesetpixel($this->image, $x, $y, $this->lightColor());

}

}

protected function show(){

header("Content-Type:image/png");

imagepng($this->image);

}

}

?>


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template