在 gravatar 中打印为什么没有输出?
直接上代码,打印的时候 为什么没有输出呢?确定已经知道到这里了。为什么打印$hash 没有值返回呢 就是一个空白页面。
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
public function gravatar($size = '100')
{
$hash = md5(strtolower(trim($this->attributes['email'])));
echo "<pre>";
print_r($hash); // 为什么这里没有返回值呢?
exit();
return "http://www.gravatar.com/avatar/$hash?s=$size";
}
}
推荐文章: