What I’m trying to do is fill a JavaScript array with files which I then want to do something with. The files are all of the type .dae and are in the directories “/collada/basement”, “/collada/ground”, “/collada/first”, and “/collada/roof”. I will probably have a separate array for each directory.
I realise I will have to use PHP to do this and then transfer them to a JavaScript array somehow. Can someone tell me how please? I’ve tried to patch it together from other sources but so far no luck.
What I’m trying to do is fill a JavaScript array with files which I
Share
In the very simplest way:
glob()does wildcard file matching pretty much exactly like any standard Unix shell would, and returns an array of what it matched. Then you hop out of PHP mode to output the javascript block, and fill in the file list that glob returned, passing it throughjson_encode()to turn your PHP array into a Javascript array.