From 0a16cc14e48172c09c06c141b62cf0c766b0f257 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Thu, 5 Mar 2020 12:36:55 +0800 Subject: [PATCH] add clear --- qq/Template.php | 14 +++++++------- wx/Template.php | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/qq/Template.php b/qq/Template.php index 334844c..2ca3cd7 100644 --- a/qq/Template.php +++ b/qq/Template.php @@ -123,18 +123,18 @@ class Template extends SmallProgram { $url = $this->sendUrl . '?access_token=' . $this->config->getAccessToken(); - $params = json_encode([ - "touser" => $this->openId, + $params = [ + "touser" => $this->openId, "template_id" => $this->templateId, - "page" => $this->page, - "form_id" => $this->formId, - "data" => $this->keywords, - ], JSON_UNESCAPED_UNICODE); + "page" => $this->page, + "form_id" => $this->formId, + "data" => $this->keywords, + ]; if (!empty($this->emphasis_keyword)) { $params['emphasis_keyword'] = $this->emphasis_keyword; } - + $params = json_encode($params, JSON_UNESCAPED_UNICODE); $this->request->setIsSSL(true); $this->request->addHeader('content-type', 'application/json'); diff --git a/wx/Template.php b/wx/Template.php index 39cf6db..bca46b0 100644 --- a/wx/Template.php +++ b/wx/Template.php @@ -121,17 +121,18 @@ class Template extends SmallProgram public function sendTemplate() { $url = $this->sendUrl . '?access_token=' . $this->config->getAccessToken(); - $params = json_encode([ + $params = [ "touser" => $this->openId, "template_id" => $this->templateId, "page" => $this->page, "form_id" => $this->formId, "data" => $this->keywords, - ], JSON_UNESCAPED_UNICODE); + ]; if (!empty($this->emphasis_keyword)) { $params['emphasis_keyword'] = $this->emphasis_keyword; } + $params = json_encode($params, JSON_UNESCAPED_UNICODE); $this->request->setIsSSL(true); $this->request->addHeader('content-type', 'application/json');