Can I use PHP to open the BT seed and download it to the server?

Source: Internet
Author: User
Tags metabase
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);?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.