123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App\Services\WeChat;
- class WeChat
- {
- private static $instances = [];
- private function __construct()
- {
- }
- public static function __callStatic($name, $publicId)
- {
- return self::make($name, $publicId);
- }
- private static function make($name, $publicId)
- {
- $application = "\\App\Services\WeChat\\{$name}";
- return new $application($publicId);
- // 单例模式
- // if (!isset(static::$instances[$application])) {
- // static::$instances[$application] = new $application($publicId);
- // }
- // return static::$instances[$application];
- }
- private function __clone()
- {
- }
- }
|