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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

求助:出現(xiàn)錯(cuò)誤提示Parse error: syntax error, unexpected '$image' (T_VARIABLE) in ...\test.php on line 4

下面分別是錯(cuò)誤提示和我的代碼,不知道錯(cuò)在哪了?

57d9174a0001e19a05000081.jpg

57d9174a0001f2da05000136.jpg


正在回答

3 回答

$src = "001.jpg" 賦值語句后少了個(gè)分號(hào)";"

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

Ymuyi 提問者

非常感謝! 我竟然沒看出來啊啊啊
2016-09-16 回復(fù) 有任何疑惑可以回復(fù)我~
#2

Ymuyi 提問者

不過,又出現(xiàn)了新問題,就是圖片沒法正常顯示額,如下所示
2016-09-16 回復(fù) 有任何疑惑可以回復(fù)我~
<?php?//test.php
	require?"image.class.php";
	$src?=?"001.jpg";
	$image?=?new?Image($src);
	
	//壓縮圖片
	$image->thumb(300,150);
	$image->show();
?>

<?php?//image.class.php
	class?Image{
		/**
		?*內(nèi)存中的圖片
		?*/
		private?$image;
		
		/**
		?*圖片的基本信息
		?*/
		private?$info;
		
		/**
		?*打開一張圖片,讀取到內(nèi)存中
		?*/
		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']}";
			$this->image?=?$fun($src);
		}
		
		/**
		?*操作圖片(壓縮)
		?*/
		?public?function?thumb($width,$height)
	????{
			$image_thumb?=?imagecreatetruecolor($width,$height);
			imagecopyresampled($image_thumb,$this->image,0,0,0,0,$width,$height,$this->info['width'],$this->info['height']);
			imagedestroy($this->image);
			$this->image=$image_thumb;
		}
		
		/**
		?*操作圖片(添加文字水印)
		?*/
		?public?function?fontMark($content,$font_url,$size,$color,$local,$angle)
		{
			$col?=?imagecolorallocatealpha($this->image,$color[0],$color[1],$color[3],$color[4]);
			imagettftext($this->image,$size,$angle,$local['x'],$local['y'],$col,$font_url,$content);
		}
		
		/**
		?*操作圖片(添加圖片水?。?		?*/
		?public?function?imageMark($source,$local,$alpha)
		{
			$info_mark?=?getimagesize($source);
			$type_mark?=?image_type_to_extension($info_mark[2],false);
			$fun_mark?=?"imagecreatefrom{$type_mark}";
			$image_mark?=?$fun_mark($source);
			imagecopymerge($this->image,$image_mark,$local['x'],$local['y'],0,0,$info_mark[0],$info_mark[1],$alpha);
			imagedestroy($image_mark);
		}
		?
		/**
		?*在瀏覽器中輸出圖片
		?*/
		public?function?show()
		{
			ob_clean();//清空(擦掉)輸出緩沖區(qū)
			header("Content-type:".$this->info['mime']);
			$funs?=?"image{this->info['type']}";
			$funs($this->image);
		}
		
		/**
		?*把圖片保存在硬盤里
		?*/
		public?function?save($newname)
		{
			$funs?=?"image{$this->info['type']}";
			$funs($this->image,$newname.'.'.$this->info['type']);
		}
		
		/**
		?*銷毀圖片
		?*/
		public?function?__destruct()
		{
			imagedestroy($this->image);
		}
	}
?>


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

goonce

注釋掉 thumb() 發(fā)現(xiàn)圖片依舊無法打印,這就基本可以鎖定構(gòu)造函數(shù)或者 show()函數(shù)出錯(cuò),最后看到 show() 函數(shù)中 $funs = "image{this->info['type']}" ,this->info['type']==> $this->info['type'](少了美元符號(hào))
2016-09-18 回復(fù) 有任何疑惑可以回復(fù)我~
#2

Ymuyi 提問者 回復(fù) goonce

謝謝,請(qǐng)收下我的膝蓋。查錯(cuò)技能Get!
2016-09-19 回復(fù) 有任何疑惑可以回復(fù)我~

不過,又出現(xiàn)了新問題,就是圖片沒法正常顯示額,如下所示

http://img1.sycdn.imooc.com//57db4e220001675b01950119.jpg

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

求助:出現(xiàn)錯(cuò)誤提示Parse error: syntax error, unexpected '$image' (T_VARIABLE) in ...\test.php on line 4

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)