add new functions

This commit is contained in:
Jianxuan Li 2015-04-27 01:34:38 +08:00
parent 80ccd891cf
commit d7ea5bef24
1 changed files with 17 additions and 3 deletions

View File

@ -15,11 +15,15 @@ class Tools {
}
/**
* @param $str
* @param $email
* @return bool
*/
public function isEmail($str){
public static function isEmail($email){
if(filter_var($email,FILTER_VALIDATE_EMAIL))
return true;
else
return false;
}
/**
@ -101,4 +105,14 @@ class Tools {
return $directory;
}
static function getHostLink()
{
$protocol = "http";
if(strpos(strtolower($_SERVER['SERVER_PROTOCOL']),"https"))
{
$protocol = "https";
}
return $protocol."://".$_SERVER['SERVER_NAME'];
}
}