J'ai un classe qui simplement doit m'afficher un lien avec les paramètres passer dans le constructeur mais elle ne m'affiche que l'email en md5(); ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
http://www.gravatar.com/avatar.php? gravatar_id=d41d8cd98f00b204e9800998ecf8427e&default=&size=
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
class Gravatar
{
	private $email=NULL;
	private $img=NULL;
	private $size=0;
	private $grav_url=NULL;
 
	function __construct($email, $img, $size)
	{
		$this_email=$email;
		$this_img=$img;
		$this_size=$size;
	}
 
	public function setGravatar()
	{
		$this_grav_url = 'http://www.gravatar.com/avatar.php?
		gravatar_id='.md5($this_email).'&default='.urlencode($this_img).
		'&size='.$this_size;
		return $this_grav_url;
	}
}
$gravatar=new Gravatar('artotal@gmail.com', 'http://www.somewhere.com/homestar.jpg', 40);
echo $gravatar->setGravatar();
?>
Merci