Obviously the old code, how to change a place will not be executed. The first suspect is the PHP version.
Finally know is my editor nodepad++ to the pit. Maybe it's not nodepad++ 's pit. In short, you need to convert to utf-8 format encoding to
<?PHPHeader(' access-control-allow-origin:* '); Header(' Access-control-allow-methods:get,post '); Header(' Access-control-allow-headers:x-requested-with,content-type '); classMenu {//The menu ID, which is taken from the database Public $id= 0; //Menu Name Public $name= ' '; //Connection Address Public $link= ' '; //icons Public $icon= ' '; //submenu, which is a list, must be initialized to an empty array, otherwise the front end will be faulted Public $subMenu= []; //constructor Function Public function__construct ($id,$n,$l,$icon= ' ') { $this->id =$id; $this->name =$n; $this->link =$l; $this->icon =$icon; }}//Menu Items$userMang=NewMenu (' 1000 ', ' User management ', ' ', ' users ');$USERADD=NewMenu (' 1001 ', ' User new ', '/user/add ');$userList=NewMenu (' 1002 ', ' user list ', '/user/list '));$userMang->submenu = [$USERADD,$userList];//management of the station inner letter$msgMang=NewMenu (' 1010 ', ' Station letter management ', ' ', ' laptop '));$MSGADD=NewMenu (' 1011 ', ' post-site letter ', '/msg/add '));$msgList=NewMenu (' 1012 ', ' Station letter list ', '/msg/list '));$msgMang->submenu = [$MSGADD,$msgList];Header(' Content-type:application/json ');Exit(Json_encode ([$userMang,$msgMang]));
A small hole in PHP that can't output json_encode