Php copies each line to a PHP text line in another text file
Okay. To be honest, this is really troublesome.
In this case, copy the number of tokens in q.txt to 1.txt/2.txt/ 3.txt.
The q.txt text format is as follows:
Ajsg blueprint herb ajsv Mo to ajsm Apple ajsu? Ajsc Yellow Fruit Tree ajsj seven-star ladybird ajsu? Ajt blue ajtl blue ajth spread to make it happen.
For the first character, separate the two characters and write them into 2.txt. no spaces are left behind all Chinese characters.
For example:
Ajsg source ajsg herb
The three characters are stored in 3.txt. Like This
Ajth spread
The token is saved to 2.txt and 4.txt.
Four characters are stored in 5.txt.
The format of 1.txt,2.txtmust be the same as that of q.txt.
For example, 1.txt
A engineer a GE aa aaa engineer aaaa engineer aaar? Aad type aad? Aadk release aadn release aadw release aadn release
Is there any great Help? please ask for a PHP solution. thank you!
Reply to discussion (solution)
4?5:$str_num;@file_put_contents($fname.".txt",$tap." ".trim($v)."\r\n",FILE_APPEND);} } fclose($handle);}?>
Let's look at the encoding format of your q.txt document! I am using or above your q.txt document is UTF-8 code; come here; you should understand;
4?5:$str_num;@file_put_contents($fname.".txt",$tap." ".trim($v)."\r\n",FILE_APPEND);} } fclose($handle);}?>
Let's look at the encoding format of your q.txt document! I am using or above your q.txt document is UTF-8 code; come here; you should understand;
Thank you very much for solving the problem! My text is UTF-8.