Can I use PHP to open the BT seed and download it to the server? I want to upload the BT file to the server and use PHP to open the BT seed file and download it to the server with PHP. one is to save hard disk space, and the other is to speed up!
Who knows? Post the code
Reply to discussion (solution)
Not a large file, but a small file.
After a long time, PHP execution of the script will time out. you must use the server command to download the large file.
Http://www.162cm.com/archives/287.html
Output the read array. */Print_r ($ data);/** @ function readbt reads the bt file; @ param $ fp file pointer @ param $ nowtype: of course, the metadata type @ return Array is an Array for saving the current MetaBase */function readBt ($ fp, $ nowtype = "DICT") {$ nowindex = ""; while (! Feof ($ fp) {$ char = (string) fread ($ fp, 1);/** in fact, take a closer look at the location of several cases, for example, which is the first and which is the last has an impact on the speed, but we do not care about it for the time being */switch ($ char) {case "1": case "2 ": case "3": case "4": case "5": case "6": case "7": case "8": case "9": case "0 ": {$ nowindex. = $ char; break;} case ":": {$ nowtype = "STRING"; $ string = fread ($ fp, intval ($ nowindex )); $ VARS [] = $ string; $ nowindex = ""; $ nowtype = ""; break;} case "I": {$ nowtype = "NUMBER "; Break;} case "e": {/** e indicates the end of the encoding, depending on the current encoding. If the value is number, the system array is saved. if the value is list or dictionary, the array is returned. */Switch ($ nowtype) {case "NUMBER": $ VARS [] = intval ($ nowindex); $ nowindex = ""; break; case "LIST ": return $ VARS; break; case "DICT": return $ VARS; break;}/** when a list or dictionary is started, recursion is used to make the result array display the directory relationship more clearly. You can also choose not to use recursion. */Case "l": {$ nowtype = "LIST"; $ VARS [] = readBt ($ fp, $ nowtype); break;} case "d ": {$ nowtype = "DICT"; $ VARS [] = readBt ($ fp, $ nowtype); break ;}}return $ VARS;} fclose ($ fp);?>
+ 1
Not a large file, but a small file.
After a long time, PHP execution of the script will time out. you must use the server command to download the large file.
Http://www.162cm.com/archives/287.html
Output the read array. */Print_r ($ data);/** @ function readbt reads the bt file; @ param $ fp file pointer @ param $ nowtype: of course, the metadata type @ return Array is an Array for saving the current MetaBase */function readBt ($ fp, $ nowtype = "DICT") {$ nowindex = ""; while (! Feof ($ fp) {$ char = (string) fread ($ fp, 1);/** in fact, take a closer look at the location of several cases, for example, which is the first and which is the last has an impact on the speed, but we do not care about it for the time being */switch ($ char) {case "1": case "2 ": case "3": case "4": case "5": case "6": case "7": case "8": case "9": case "0 ": {$ nowindex. = $ char; break;} case ":": {$ nowtype = "STRING"; $ string = fread ($ fp, intval ($ nowindex )); $ VARS [] = $ string; $ nowindex = ""; $ nowtype = ""; break;} case "I": {$ nowtype = "NUMBER "; Break;} case "e": {/** e indicates the end of the encoding, depending on the current encoding. If the value is number, the system array is saved. if the value is list or dictionary, the array is returned. */Switch ($ nowtype) {case "NUMBER": $ VARS [] = intval ($ nowindex); $ nowindex = ""; break; case "LIST ": return $ VARS; break; case "DICT": return $ VARS; break;}/** when a list or dictionary is started, recursion is used to make the result array display the directory relationship more clearly. You can also choose not to use recursion. */Case "l": {$ nowtype = "LIST"; $ VARS [] = readBt ($ fp, $ nowtype); break;} case "d ": {$ nowtype = "DICT"; $ VARS [] = readBt ($ fp, $ nowtype); break ;}}return $ VARS;} fclose ($ fp);?>