How does php read txt text and store it in the mysql database?
Source: Internet
Author: User
How does php read txt text and store it in the mysql database! This post was last edited by pigpigpighappy from 2012-12-1717: 07: 47! How does php read txt text and store it in the mysql database? Complete Code! Suitable for extra points! Thank you! How does php read txt text and store it in the mysql database!
This post was last edited by pigpigpighappy at 17:07:47 on! How does php read txt text and store it in the mysql database? Complete Code! Suitable for extra points! Thank you!
------ Solution --------------------
It depends on whether your txt file is written in the form of database fields. If yes, I will do this, and I will use txt to add an email address.
Each line requires only one address
// Upload txt text
If ($ _ FILES ['text'] ['name']) {
$ Path = '../upload ';
If (! File_exists ($ path )){
Mkdir ($ path );
}
If (! Is_dir ($ path )){
Mkdir ($ path );
}
$ P = strrchr ($ _ FILES ['text'] ['name'], '.');
If (preg_match ("/txt/", $ p )){
$ File = $ path. '/'. date ('ymmd'). time (). $ p;
Move_uploaded_file ($ _ FILES ['text'] ['tmp _ name'], $ file );
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.