Skip to content

Commit

Permalink
修正yii2-wx生成公众后菜单报错问题(invalid charset. please check your request, if i…
Browse files Browse the repository at this point in the history
…nclude \uxxxx will create fail)。
  • Loading branch information
abei2017 committed Oct 20, 2018
1 parent 0b4d879 commit be8c8d0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/mp/menu/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use abei2017\wx\core\Driver;
use abei2017\wx\core\AccessToken;
use yii\helpers\VarDumper;
use yii\httpclient\Client;
use abei2017\wx\core\Exception;

Expand Down Expand Up @@ -66,8 +67,11 @@ public function ls(){
* @return boolean
*/
public function create($buttons = []){
$response = $this->post(self::API_MENU_CREATE_URL."?access_token=".$this->accessToken,$buttons)
->setFormat(Client::FORMAT_JSON)->send();
$this->httpClient->formatters = ['uncodeJson'=>'abei2017\wx\helpers\JsonFormatter'];
$request = $this->post(self::API_MENU_CREATE_URL."?access_token=".$this->accessToken,$buttons)
->setFormat('uncodeJson');

$response = $request->send();

if($response->isOk == false){
throw new Exception(self::ERROR_NO_RESPONSE);
Expand Down

0 comments on commit be8c8d0

Please sign in to comment.