function create_menu($data){
use using using to menu/create?access_token=" .$this->get_token());
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);//https
verwenden curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, false);
if (!empty( $json_str)){
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt(($ch ,CUR) LOPT_RETURNTRANSFER,true);
$output = curl_exec($ch) ;//Ausführen und den Inhalt des HTML-Dokuments abrufen
if(curl_errno($ch)){//Die letzte Fehlernummer zurückgeben
return curl_error( $ch); //Eine Zeichenfolge zurückgeben, die den letzten Fehler in der aktuellen Sitzung schützt
} L Curl_Close ($ ch); // Das CURL-Handle freigeben
Return $ OUTPUT;}}
Öffentliche Funktion get_menu () {
Header ( 'Content-Type: Text/HTML; Charset = UTF -8 '); -$ result=file_get_contents("https://api.weixin.qq.com/cgi-bin/menu/get?access_token=".$this ->get_token());
return $result;
}
public function del_menu (){
$result=file_get_contents("https://api.weixin.qq.com/cgi-bin/menu/delete?access_token =".$this->getToken());
using . }
function create_xin_menu($data){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.weixin. qq.com/cgi-bin/menu/addconditional?access_token=". $this -> getToken());
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_ SSL_VERIFYHOST, FALSE);
curl_setopt($ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (kompatibel; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); ( $ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if (curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
$json_arr = (array)json_decode($tmpInfo);
if( array_key_exists('menuid',$ json_arr)){
return $json_arr['menuid'];
}else{
return false;
}
}
}
$wx=new. WX();
$wx->create_menu($data);
$arr=array(
'button'=>array(
array(
'type'=>'click',
'name'=>'每日新闻',
'key'=>' V1001_XIN_WEN'
),
array(
'name'=>'综合',
'sub_button'=>array(
array(
'name'=>'音乐',
'type'=>' view',
'url'=>'http://s.music.so.com/s?src=relation_music&q=%E6%B5%81%E8%A1%8C'
),
array(
' name'=>'搞笑',
'type'=>'view',
'url'=>'https://v.qq.com/x/channel/fun'
)
),
),
array(
'name'=>'学习',
'sub_button'=>array(
array(
'name'=>'php中文网',
'type'=>' Ansicht',
'url'=>'//m.sbmmt.com/'
),
),
)
),
);
$data=json_encode($arr, JSON_UNESCAPED_UNICODE);
$data 在哪呢,你没传