PHP opens TXT, writes to Mysql, involves file reading, string array change and time format and change.

time:13-06-21 forum:PHP tools and code
  Reprinted from http://blog.sina.com.cn/s/blog_538a85630100mvo7.html



this time, this time to guide a batch of data to MySQL, add something that has not written a few details of PHP for a few months, so here is a record. Deepen your memory, so as not to forget it in the future.



1, the way to open a file: $fileopen = fopen ($filepath,'rt');

r refers to the mode of reading, which is converted to a binary file, and naturally the physical address of a file is not the same as the path formula, but' / 'is a portability. Higher, window is a compatible



2, check the file to the end, while (! Feof ($fileopen)) {* * * * * * * * *}





5, intercepting string, remove the last character, $ss = substr ($theV[1], 0, -1);



7, can see clearly, and the opposite of explode, implode, array is combined into string, $ss = implode ($s_ary, "); I a.quot; / / / / / March 10, 2001, 5:16 pm
$today = date (.Quot; m.d.y.quot;); / / / 03.10.01
$today = date; / / / 10, 3. Te ('h-i-s, j-m-y, it is w Day z); / / / 05-16-17, 10-03-01, 163116186 Fripm01
$today. / / / / 17:03:17 m is month
$today = date (.Quot; H:i:s.quot;); / / / 17:16:17
Handbook, but the most commonly used is

date; / / / / always conforms to the idea of China Think, must write about the time operation class, first go to CSDN to see if others have written, although it is not very troublesome to write one, but since the choice of PHP is the choice of the advantage of open source.

time operation is a good package, such as the standard Day data, according to the Y-m-d arrangement, can be direct days, or month, and with hours, minutes, can be directly - hours and minutes, seconds, automatically conversion results.

it is more convenient to use as much as possible!

prev:PHP reads the MYSQL contents into two-di... next:500 yuan of dl1301 all-around students i...
post comment
Notice



approved   2 teachers and 7 children were both ...   PHP cURL to achieve simulation login...   The 78 year old academician sits on ...   1978 Henan arts champion Liu Zhenyun...   Looking for the most beautiful filia...
rand   Snoopy is used to imitate the functi...   PHP class of Snoopy powerful browser...   Advantages and disadvantages of cURL...   PHP cURL to achieve simulation login...   PHP curl function simulated crawler ...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com