/** *单例模式示例 */final class Sigle{ private static $ins = null; public static function getIns(){ if(self::$ins === null){ self::$ins = new self(); } return self::$ins; } /** * 封锁重写和继承 */ final private function __construct(){ } /** * 封锁克隆 */ final private function __clone(){ }}$s1 = Sigle::getIns();$s2 = Sigle::getIns();if($s1===$s2){ echo '是同一个对象';}else{ echo '不是同一个对象';}