Joke Collection Website - Talk about mood - Tell me about 3333333
Tell me about 3333333
1. First, get the contents of file 1.txt, and cut it according to the line break to get an array $ex 1.
2. Cut the contents of file2.txt into the array $ex2 in the same way.
3. Cycle $ex 1 array (it should be file 1.txt file2.txt, and cycle file 1.txt when the number of rows is different).
Set a random number in the loop.
Combine the corresponding contents in $ ex1$ ex 2 into a record and save it to file3.txt
Finally, file3.txt is the result you want.
Display code:
& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)
//Predefined variables
$ contents 1 =“”;
$ contents 2 =“”;
$ contents 3 =“”;
//Get the contents of file 1
$ contents 1 = file _ get _ contents(' file 1 . txt ');
//Cut the array with line breaks
$ex 1 = explode('
,$ contents 1);
//Get the contents of file 1
$ contents 2 = file _ get _ contents(' file 2 . txt ');
//Cut the array with line breaks
$ex2 = explosion ('
,$ contents 2);
$ count 1 = count($ ex 1);
$ count 2 = count($ ex2);
//Loop values and assign values
for($ I = 0; $ i & lt$ count 1; $i++){
//Set the random number
$j = rand(0,$ count 1- 1);
Content 3. = $ex 1[$j]。 $ex2[$i]。 '
;
}
//Write file
file_put_contents('file3.txt ',$ contents 3);
You can copy this code and create a new file 1.txt file2.txt to write the corresponding test content (note that the line has been broken).
test
- Previous article:Good morning, the classic in my heart says: learn to be strong in everything.
- Next article:Who are you? Tell me.
- Related articles
- Pharmacist examination subjects
- Cherish your eyes and protect your eyesight.
- I urgently need the original text of Zhang Xiaofeng's "Music Classroom"! ! ! You can just talk about its main content! (I’m going to write my review today!)!
- 50 sentences for my predecessor
- Girls' simple temperament pictures
- A dark conversation
- How to make jiaozi with leek meat stuffing delicious?
- Ancient poems of inspirational positive energy
- Drink more soup to nourish people in dog days. This soup is fragrant, nourishing and relieving summer heat, clearing liver and reducing fire. My family must drink it every week.
- The circle of friends is suitable for Aite himself: Many people have changed and become me along the way.