Recently Yang Small made a PHP yearbook, the students themselves there to add or modify names, mailboxes, OICQ and other information, and saved in the MySQL database. A day Yang small suddenly thought, if you can use PHP to generate a file for the students to download and import this information into their foxmail address book, that's how good!
Say dry, soon Yang will be introduced this function. How is that possible? This is explained only by exporting names, mailboxes, and Oicq three items.
For information can import Foxmail Address Book, of course, first understand the import foxmail address Book file content and format. Open Foxmail4.2 An account address Book, in its menu bar "Tools"-"import" can see, foxmail support two kinds of external file import: "CSV file" and "WAB file". We chose to generate a CSV file. What about the content and format of the CSV file that can import Foxmail? Let's start by exporting a CSV file from Foxmail to see. Select a folder in the Foxmail address book that does not have an empty record, execute tools-Export-text file, save file named TEMP. CSV ", in" Select output field "in" Next ", select" Name "," email address "and" OICQ ", then click" Finish "to generate" TEMP "in the specified path. CSV "file. If you install the Microsoft Office series, you will find that this is a file opened by default in Excel, which is actually a comma-separated value file for Excel, double-click on its interface after opening.
We are still unable to know its write format in this case. Add the TEMP. CSV "file to open with Notepad, you can find its format is very simple: the first line of the file is the field of the Foxmail Address Book, the other rows are the values of the field, the fields and values are separated by commas. So we generate CSV files in PHP in this format, and others can download and import their foxmail!
However, there is one more problem to solve, that is, since the file with a comma as a separate value, if the database record has a comma (note: The following symbol if there is no special description of the English symbol) what to do? Of course, you can first replace the comma in the data with a Chinese comma, but there is also a method, that is, if the CSV file corresponding fields are separated by double quotation marks ("that is" ") as a separate value, and the comma is not a separate value, and the field of two consecutive double quotation marks (" "") is only as a display And not as a separate value.
With these realizations, we can write a PHP file that exports a CSV file:
Run the above PHP file on the server and download the "tofoxmail.csv" file to open it with Notepad.
In the Foxmail Address Book, click "Tools"-"Import"-"CSV file" ..., a lot of data in the database is imported all of a sudden, this idea is not bad!
(The above procedures are tested in both Apache+php4+mysql and Iis+php4+mysql.) )
http://www.bkjia.com/PHPjc/314834.html www.bkjia.com true http://www.bkjia.com/PHPjc/314834.html techarticle recently Yang Small made a PHP yearbook, the students themselves there to add or modify names, mailboxes, OICQ and other information, and saved in the MySQL database. One day Yang small suddenly thought, if can use ...