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

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

->報錯怎么解決

Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in D:\phpStudy\WWW\image\image.class.php on line 34

34行與老師寫的相同,怎么解決

正在回答

2 回答

這是我的代碼? 運行沒有問題


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

你先把代碼弄出來


test.php

<?php
require "image.class.php";
/*水印文字*/
$src='002.jpg';
$content='哈哈,HELLO WORLD!!';
$font_url='msyh.ttc';
$size=10;
$angle=10;
$color = array(
?? ?0=>0,
?? ?1=>0,
?? ?2=>0,
?? ?3=>50,
?);
$local=array(
?? ?'X'=>20,
?? ?'Y'=>100,
?? ?);

/*水印圖片*/
$local1=array(
?? ?'X'=>0,
?? ?'Y'=>0,
?? ?);
$source='001.png';
$alpha=30;
$image=new Image($src);
$image->thumb(200,200);
$image->fontMark($content,$font_url,$size,$color,$local,$angle);
$image->imageMark($source,$local1,$alpha);
$image->show();
$image->save(6);
?>

image.class.php

<?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']}";
??? $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[2],$color[3]);
? ??? ?imagettftext($this->image,$size,$angle,$local['X'],$local['Y'],$col,$font_url,$content);
?? }
?? /*操作圖片(添加圖片水印)*/
?? public function imageMark($source,$local1,$alpha){
? ??? ?$info2=getimagesize($source);
?? ?// 3 水印圖片類型
? ??? ?$type2=image_type_to_extension($info2[2],false);
?? ?// 4 在內(nèi)存中創(chuàng)建一個和水印照片一樣的圖像
? ??? ?$fun2="imagecreatefrom{$type2}";
? ??? ?$water=$fun2($source);
?? ?// 5 把水印照片給復(fù)制到原圖上
? ??? ?imagecopymerge($this->image,$water,$local1['X'],$local1['Y'],0,0,$info2[0],$info2[1],$alpha);
?? ?// 6 銷毀水印圖片
? ??? ?imagedestroy($water);



?? }
?
? //輸出圖片到瀏覽器
?? public function show(){
???? header("Content-type:".$this->info['mime']);
???? $func="image{$this->info['type']}";
???? $func($this->image);
?}
?//保存到硬盤中
? public function save($newname){
???? $func="image{$this->info['type']}";
???? $func($this->image,$newname.'.'.$this->info['type']);
? }
? //銷毀圖片
? public function __destruct(){
?? imagedestroy($this->image);
? }
? }
?>



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

舉報

0/150
提交
取消

->報錯怎么解決

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

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

幫助反饋 APP下載

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

公眾號

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