Rumah > Soal Jawab > teks badan
发现部分空间是可以
部分空间不可以,报下面的错误
{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}
梦想无需昭告天下2017-09-26 23:14:44
<?php
/**
* Kategori kod pengesahan
*/
$code= new Code();
$code->outImage();
class Code
{
protected $number;
dilindungi $codeType;
dilindungi $width;
dilindungi $height;
dilindungi $imej;
dilindungi $kod;
fungsi awam __construct($Type=4,$code=4,$kod 100,$tinggi=30)
{
$ini->nombor=$nombor;
$ini->codeType=$codeType;
$ini->width=$thi;
->height=$height; $this->code=$this->createCode(); } public function __get($name){ if ($name=='code' ) { pulangkan $this->code; }else{ return false; } } public function __destruct(){ imagedestroy( imagedestroy&);-g } fungsi dilindungi createCode(){ suis ($this->codeType) { case '0': $code=$this->getNumberCode(); break;1':
$code=$this->getCharCode();
break;
case '2':
$code=$this->getNumberCharCode();
break;
lalai:
die("对不起,不支持该验证码类型!!!");
}
pulangkan $kod;
}
)('nombordilindungi fungsi $' , julat (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);
}
fungsi dilindungi 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}
createImage(){ $this->image=imagecreatetruecolor($this->width, $this->height); } protected function fillBack(){ imagefill($this-> imej, 0, 0, $this->lightColor()); } fungsi dilindungi lightColor(){ return imagecolorallocate($this->image, mt_rand(130,25), mt_rand(130,25), mt_rand(130,25) (130,255)); } fungsi dilindungi darkColor(){ kembalikan imagecolorallocate($this->image, mt_rand(0,120), mt_rand(0,120), mt_rand(0,120));ed fungsi drawChar(){
untuk ($i=0; $i <$ini->nombor; $i++) {
$Width=$this->width/$this->nombor;
$x=mt_rand($i*$Width+10,($i+1)*$Width-15);
$y=mt_rand(0,$this->height-18);
imagechar( $this->imej, 6, $x, $y, $this->kod[$i], $this->darkColor());
}
}
fungsi dilindungi drawDistrub(){
untuk ($i=0; $i < 300; $i++) {
$x=mt_rand(0,$ini->lebar);
$y=mt_rand(0,$ini-> ketinggian);
imagesetpixel($this->image, $x, $y, $this->lightColor());
}
}
protected function show(){
header("Content -Type:image/png");
imagepng($this->image);
}
}
?>