Defining an array in php is simple, but in js it will cause an error if it is made into a subscript, so use the object to do it
var top_ = {'index':'Home','user':'user','tree':'Module Tree'} ;var all_list = [{ "index": [ {'name':'Website column management','url':'1.html'}, {'name':'Website column management','url':'2.html'} ] },{"user": [ {'name':'User management','url':'user.html'}, {'name':'User addition','url':'add.html'} ]},{"tree": [ {'name':'Module tree management','url':'manager.html'}, {'name':'Module tree add','url':'add_new.html'}, {'name':'Module tree adds 333','url':'add_ne33w.html'} ]}];A module tree array is defined above. . . .
In addition, it is also very easy to retrieve when extracting data
//Get the menu on the left function return_left_menu_by_index(index){var left_ = '' ;for(var i in all_list){for(var j in all_list[i]){ if(j == index){//The menu displayed by default //console.dir(all_list[i][j]);for(var k in all_list[i][index]){//console.dir(k);var new_onclick = 'onclick=change_right_url("'+all_list[i][index][k].url+'")' ;left_+='<div '+new_onclick+'>'+all_list[i][index][k].name+'</div>';}}}} return left_ ;}The above method of defining object arrays (combined) multi-dimensional arrays of js is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.