add clear
This commit is contained in:
@@ -25,11 +25,8 @@ abstract class Miniprogarampage
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
if (!($this->request instanceof WxClient)) {
|
||||
$this->request = new WxClient();
|
||||
}
|
||||
$this->request = WxClient::getInstance();
|
||||
$this->request->setIsSSL(true);
|
||||
$this->request->setAgent($this->config->getAgent());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,6 +39,7 @@ abstract class Miniprogarampage
|
||||
static::$instance = new static();
|
||||
}
|
||||
static::$instance->config = $config;
|
||||
static::$instance->request->setAgent($config->getAgent());
|
||||
return static::$instance;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,4 +91,15 @@ class Wx
|
||||
{
|
||||
return Notify::getInstance($this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WxClient
|
||||
*/
|
||||
public function getClient()
|
||||
{
|
||||
$client = WxClient::getInstance();
|
||||
$client->setAgent($this->config->getAgent());
|
||||
return $client;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,23 @@ class WxClient
|
||||
const DELETE = 'delete';
|
||||
const OPTIONS = 'option';
|
||||
|
||||
private static $_instance;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WxClient
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if (!(static::$_instance instanceof WxClient)) {
|
||||
static::$_instance = new WxClient();
|
||||
}
|
||||
return static::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $host
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user