谁能帮我解释一下这个PHP代码的意思
最好把带参数的参数是代表什么标一下。拜谢<?php$referer=$_SERVER['HTTP_REFERER'];if(!strpos($referer,'infoc...
最好把带参数的参数是代表什么标一下。拜谢
<?php
$referer=$_SERVER['HTTP_REFERER'];
if(!strpos($referer,'infocenter')){
header('Location: moren.png');
exit();
}
$urlArr = explode('/',$referer);
$qq=$urlArr['3'];
$username = getQQName($qq);
$fontfile = "../fonts/msyh.ttf";
header("Content-type: image/png");
$image="bj.png";
$im=imagecreatefrompng($image);
$ys1=ImageColorAllocate($im,88,48,224);
$ys2=ImageColorAllocate($im,0,96,192);
$ys3=ImageColorAllocate($im,255,255,255);
$ys4=ImageColorAllocate($im,255,255,255);
$ys5=ImageColorAllocate($im,255,255,255);
$ys6=ImageColorAllocate($im,255,255,255);
ImageTTFText($im,12,0,0,14,$ys1,$fontfile,$username.'昨天晚上在网吧被人偷拍、');
ImageTTFText($im,12,0,5,39,$ys2,$fontfile,'偷拍者查看到他的QQ号码为'.$qq);
ImageTTFText($im,12,0,0,50,$ys3,$fontfile,'');
ImageTTFText($im,12,0,0,14,$ys4,$fontfile,'');
ImageTTFText($im,12,0,0,14,$ys5,$fontfile,'');
ImageTTFText($im,12,0,0,14,$ys6,$fontfile,'');
Imagegif($im);
ImageDestroy($im);
exit();
function getQQNick($qq){
$str = file_get_contents('r.qzone.qq.com/cgi-bin/user/cgi_personal_card?uin='.$qq);
$pattern = '/'.preg_quote('"nickname":"','/').'(.*?)'.preg_quote('",','/').'/i';
preg_match ( $pattern,$str, $result );
return $result[1];
}
function getQQName($qq){
if (!$username) {
$username = getQQNick($qq);
}
return $username;
}
?> 展开
<?php
$referer=$_SERVER['HTTP_REFERER'];
if(!strpos($referer,'infocenter')){
header('Location: moren.png');
exit();
}
$urlArr = explode('/',$referer);
$qq=$urlArr['3'];
$username = getQQName($qq);
$fontfile = "../fonts/msyh.ttf";
header("Content-type: image/png");
$image="bj.png";
$im=imagecreatefrompng($image);
$ys1=ImageColorAllocate($im,88,48,224);
$ys2=ImageColorAllocate($im,0,96,192);
$ys3=ImageColorAllocate($im,255,255,255);
$ys4=ImageColorAllocate($im,255,255,255);
$ys5=ImageColorAllocate($im,255,255,255);
$ys6=ImageColorAllocate($im,255,255,255);
ImageTTFText($im,12,0,0,14,$ys1,$fontfile,$username.'昨天晚上在网吧被人偷拍、');
ImageTTFText($im,12,0,5,39,$ys2,$fontfile,'偷拍者查看到他的QQ号码为'.$qq);
ImageTTFText($im,12,0,0,50,$ys3,$fontfile,'');
ImageTTFText($im,12,0,0,14,$ys4,$fontfile,'');
ImageTTFText($im,12,0,0,14,$ys5,$fontfile,'');
ImageTTFText($im,12,0,0,14,$ys6,$fontfile,'');
Imagegif($im);
ImageDestroy($im);
exit();
function getQQNick($qq){
$str = file_get_contents('r.qzone.qq.com/cgi-bin/user/cgi_personal_card?uin='.$qq);
$pattern = '/'.preg_quote('"nickname":"','/').'(.*?)'.preg_quote('",','/').'/i';
preg_match ( $pattern,$str, $result );
return $result[1];
}
function getQQName($qq){
if (!$username) {
$username = getQQNick($qq);
}
return $username;
}
?> 展开
1个回答
展开全部
<?php
$referer=$_SERVER['HTTP_REFERER'];//网页访问着的来路url
if(!strpos($referer,'infocenter')){
header('Location: moren.png');//如果来路的url不包含infocenter将跳转到moren.png这个图片
exit();
}
$urlArr = explode('/',$referer);//用/拆分url 实例: http://user.qzone.com/10000/infocenter //某个qq个人中心的网址
$qq=$urlArr['3'];//数组指针3刚好是qq号
$username = getQQName($qq);//调用函数获取qq昵称
$fontfile = "../fonts/msyh.ttf";//字体文件
header("Content-type: image/png");//输出图片
$image="bj.png";//图片名称
/*
*
* 一下语句是创建一个图片
*/
$im=imagecreatefrompng($image);
$ys1=ImageColorAllocate($im,88,48,224);
$ys2=ImageColorAllocate($im,0,96,192);
$ys3=ImageColorAllocate($im,255,255,255);
$ys4=ImageColorAllocate($im,255,255,255);
$ys5=ImageColorAllocate($im,255,255,255);
$ys6=ImageColorAllocate($im,255,255,255);
ImageTTFText($im,12,0,0,14,$ys1,$fontfile,$username.'昨天晚上在网吧被人偷拍、');
ImageTTFText($im,12,0,5,39,$ys2,$fontfile,'偷拍者查看到他的QQ号码为'.$qq);
ImageTTFText($im,12,0,0,50,$ys3,$fontfile,'');
ImageTTFText($im,12,0,0,14,$ys4,$fontfile,'');
ImageTTFText($im,12,0,0,14,$ys5,$fontfile,'');
ImageTTFText($im,12,0,0,14,$ys6,$fontfile,'');
Imagegif($im);
ImageDestroy($im);
exit();
//获取qq昵称的函数
function getQQNick($qq){
$str = file_get_contents('r.qzone.qq.com/cgi-bin/user/cgi_personal_card?uin='.$qq);
$pattern = '/'.preg_quote('"nickname":"','/').'(.*?)'.preg_quote('",','/').'/i';
preg_match ( $pattern,$str, $result );
return $result[1];
}
function getQQName($qq){
if (!$username) {
$username = getQQNick($qq);
}
return $username;
}
?>
这够详细了吧,菜鸟都识
追问
我想再加一个头像、可是头像不是文本水印。怎么加啊
追答
imagecreatefrompng 用这个函数
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询