<?php
class Single{
private static $single=null;
public static function getS()
{
//如果存在就无法创建
if(!self::$single)
{
self::$single=new self;
self::$single->pname="dogg";
}
return self::$single;
}
public $pname='';
}
$dog=Single::getS();
$dog=Single::getS();
echo $dog->pname;
print_r($dog);
?>