/** * 创建菜单 */ public function createMenu() { header("Content-type:text/html;charset=utf-8"); // 注意过期时间 access_token无效 $access_token = $this->getWxToken(); var_dump($access_token); echo "<br />"; $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$access_token; $postArr = array( "botton"=>array( array( "name"=>"menu1", "type"=>"click", "key"=>"V1001_TODAY_MUSIC", ) ) ); var_dump($postArr); echo "<br />"; // 中文转json爆错? $postJson = json_encode($postArr); var_dump($postJson); echo "<br />"; $result = http_crul($url,$type="post",$res="json",$postJson); //封装的 curl switch ($result['errcode']){ case 40016 : $_SESSION['access_token'] = null; $this->createMenu(); break; default: break; } var_dump($result); echo "<br />"; }
string(138) "fr9zVJ8Y76AraXS_cewUTVqbG7ILQxU149f-UqF57yRHd3aGDHbvw3a17QqOsqNbV2vfGD2S5DF-2J-n8tliKnX20ZvHhpHM9axCPUi2EfYIFHvhvyIRer4H5ceNjmNCSWVaAGAFJI" array(1) { ["botton"]=> array(1) { [0]=> array(3) { ["name"]=> string(5) "menu1" ["type"]=> string(5) "click" ["key"]=> string(17) "V1001_TODAY_MUSIC" } } } string(70) "{"botton":[{"name":"menu1","type":"click","key":"V1001_TODAY_MUSIC"}]}" array(2) { ["errcode"]=> int(45009) ["errmsg"]=> string(55) "reach max api daily quota limit hint: [cipiMA0694vr32!]" }
我使用 微信wiki 的自带数据就可以生成自定义菜单,系不系数据转json 这里出现了问题。请指教。
smile225
慕田峪3555374