PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.
-
Upload
gilbert-mcgee -
Category
Documents
-
view
225 -
download
3
Transcript of PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.
![Page 1: PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.](https://reader035.fdocuments.in/reader035/viewer/2022071718/56649f0c5503460f94c1f20f/html5/thumbnails/1.jpg)
PHP
![Page 2: PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.](https://reader035.fdocuments.in/reader035/viewer/2022071718/56649f0c5503460f94c1f20f/html5/thumbnails/2.jpg)
Reading file
Create 2 files 1.document.txt2.Readfile.php
![Page 3: PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.](https://reader035.fdocuments.in/reader035/viewer/2022071718/56649f0c5503460f94c1f20f/html5/thumbnails/3.jpg)
Readfile.php
<?php$file="./document.txt";$document=file_get_contents($file);echo $document;?>
![Page 4: PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.](https://reader035.fdocuments.in/reader035/viewer/2022071718/56649f0c5503460f94c1f20f/html5/thumbnails/4.jpg)
<?phpheader("Content-Type:text/plain");$file="./document.txt";$document=file_get_contents($file);echo $document;?>
![Page 5: PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.](https://reader035.fdocuments.in/reader035/viewer/2022071718/56649f0c5503460f94c1f20f/html5/thumbnails/5.jpg)
<?phpheader("Content-Type:text/plain");$file="./document.txt";$document=file_get_contents($file);echo $document;echo "<br><b>This is bold</b>";?>
![Page 6: PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.](https://reader035.fdocuments.in/reader035/viewer/2022071718/56649f0c5503460f94c1f20f/html5/thumbnails/6.jpg)
<?php$file="./document.txt";$document=file_get_contents($file);$line=explode("\n",$document);foreach($line as $newline){echo "<b>".$newline."</b><br>";}?>
![Page 7: PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.](https://reader035.fdocuments.in/reader035/viewer/2022071718/56649f0c5503460f94c1f20f/html5/thumbnails/7.jpg)
Insert into file
Create 2 files 1. line.txt2. insertfile.php
![Page 8: PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.](https://reader035.fdocuments.in/reader035/viewer/2022071718/56649f0c5503460f94c1f20f/html5/thumbnails/8.jpg)
Inserfile.php
<?php$file="./line.txt";$write="This is line One\n";file_put_contents($file,$write);?>
![Page 9: PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.](https://reader035.fdocuments.in/reader035/viewer/2022071718/56649f0c5503460f94c1f20f/html5/thumbnails/9.jpg)
Inserfile.php
<?php$file="./line.txt";$write="This is line Two\n";file_put_contents($file,$write);?>
![Page 10: PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.](https://reader035.fdocuments.in/reader035/viewer/2022071718/56649f0c5503460f94c1f20f/html5/thumbnails/10.jpg)
Inserfile.php
<?php$file="./line.txt";$write="This is line Three\n";file_put_contents($file,$write,FILE_APPEND);?>
![Page 11: PHP. Reading file Create 2 files 1.document.txt 2.Readfile.php.](https://reader035.fdocuments.in/reader035/viewer/2022071718/56649f0c5503460f94c1f20f/html5/thumbnails/11.jpg)
Date,Time,Day
<?php$date=date('m-d-y');$time=date('h:i:s');$day=date('l');echo "this current date is ".$date.”<br>”;echo "this current time is ".$time.”<br>”;echo "this current day is ".$day.”<br>”;?>