public function create($statement) { $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={$this->access_token}"; if (is_array($statement)) { include dirname(__FILE__) . '/../util/arr_urlencode.php'; $statement = arr_urlencode($statement); $statement = urldecode(json_encode($statement)); } $client = new HttpClient($url); $client->setParameter($statement); return $client->post(); }
function arr_urlencode($arr) { if ($arr === null) { return null; } if (!is_array($arr)) { return urlencode($arr); } foreach ($arr as $key => $value) { $arr[$key] = arr_urlencode($value); } return $arr; }