第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

求大神們解答,小白很無奈

<?php
class Image{
? ?private $info;
? ?private $image;
//打開圖片
? ?public function _construct($src){
? ? ? ?$info=getimagesize($src);
? ? ? ?$this->info=array(
? ? ? ? ? ?"width"=>$info[0],
? ? ? ? ? ?"height"=>$info[1],
? ? ? ? ? ?"type"=>image_type_to_extension($info['2'],false),
? ? ? ? ? ?"mime"=>$info[mime]
? ? ? ? ? ?);
? ? ? ?$fun="imagecreatefrom{$this->info['type']}";
? ? ? ?$image=$fun($src);
? ?}
? ?//壓縮圖片
? ?public function thumb($width,$height){
? ? ? ?$thumb_img=imagecreatetruecolor($width,$height);
? ? ? ?//參數未定義
? ? ? ?imagecopyresampled($thumb_img,$this->image,0,0,0,0,$width,$height,$this->info['width'],$this->info['height']);
? ? ? ?//出錯
? ? ? ?imagedestroy($this->image);
? ? ? ?$this->image=$thumb_img;
? ?}
? ?//在瀏覽器顯示圖片
? ?public function show(){
? ? ? ?header("Content-type:".$this->info["mime"]);
? ? ? ?$func="image{$this->info['type']}";
? ? ? ?//出錯
? ? ? ?$func($this->image);
? ?}
? ?//保存圖片至硬盤
? ?public function save($newName){
? ? ? ?$funcs="image{$this->info['type']}";
? ? ? ?$funcs($this->image,$newName.'.'.$this->info['type']);
? ?}
? ?//銷毀圖片
? ?public function _destruct(){
? ? ? ?imagedestroy($this->image);
? ?}





}




?>



<?php
require "thumbclass.php";
$src="bg.jpg";
$image=new Image($src);
$image->thumb(300,500);
$image->show();
?>http://img1.sycdn.imooc.com//5a26852100015dcf10810562.jpg

正在回答

1 回答

你require那里的類名字都不對吧

1 回復 有任何疑惑可以回復我~
#1

驀默 提問者

我require里引入的是我對應的php文件,我檢查過了,是thumbclass.php這個文件,路徑也沒錯啊
2017-12-06 回復 有任何疑惑可以回復我~
#2

aimoty 回復 驀默 提問者

你改成thumb.class.php
2017-12-06 回復 有任何疑惑可以回復我~
#3

aimoty 回復 驀默 提問者

好吧,我來說你問題在哪,首先構造函數和析構函數前面都是兩個下劃線,15行要調用$image必須要$this->image
2017-12-06 回復 有任何疑惑可以回復我~
#4

驀默 提問者 回復 aimoty

謝謝大神,多虧了你才解決掉
2017-12-27 回復 有任何疑惑可以回復我~
#5

驀默 提問者 回復 aimoty

15行不用改
2017-12-27 回復 有任何疑惑可以回復我~
查看2條回復

舉報

0/150
提交
取消

求大神們解答,小白很無奈

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號