<?php
class T
{
public $client = [];
protected static $instance;
protected function __construct()
{
}
public function getInstance($a = '')
{
if (!isset(self::$instance)) {
self::$instance = new self();
}
if (!isset(self::$instance->client[$a])) {
self::$instance->client[$a] = $a;
}
return self::$instance;
}
public static function index()
{
echo '<pre>';
var_dump(self::$instance->client);
}
}
T::getInstance('a')->index();
T::getInstance('b')->index();
T::getInstance('c')->index();
T::getInstance('d')->index();
T::getInstance('e')->index();
« Previous Post: PDO绑定参数的神奇bug
Next Post: git修改项目的邮箱与名称 »