diff --git a/wx/Config.php b/wx/Config.php index 05dd8cc..483eb8f 100644 --- a/wx/Config.php +++ b/wx/Config.php @@ -107,6 +107,27 @@ class Config */ private $key = ''; private $access_token = ''; + private $agent = ''; + + /** + * @return string + */ + public function getAgent(): string + { + return $this->agent; + } + + /** + * @param string $agent + * @return Config + */ + public function setAgent(string $agent): Config + { + $this->agent = $agent; + return $this; + } + + /** * @return string diff --git a/wx/Miniprogarampage.php b/wx/Miniprogarampage.php index 5ca6dd9..e6e3d0d 100644 --- a/wx/Miniprogarampage.php +++ b/wx/Miniprogarampage.php @@ -29,6 +29,7 @@ abstract class Miniprogarampage $this->request = new WxClient(); } $this->request->setIsSSL(true); + $this->request->setAgent($this->config->getAgent()); } /**