PHP中使用静态方法

Categories: PHP; Tagged with: ; @ September 8th, 2010 21:03

定义静态方法:

Class EmailUtils {
	/** 判断给定的字符是否为Email字符. */
	public static function isEmailChar($char) {
		return eregi("[a-zA-Z0-9\.\_\@]", $char);
	}

} //end of class 

类内部使用静态方法: self::isEmailChar($str);

类外部使用静态方法: EmailUtils ::isEmailChar($str);



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.