web 2.0

How to use PHP & Search Text File

How to use PHP & Search Text File Learn how to use the PHP to Search wording on Text file

ShotDev Focus:
- PHP & Search Text File

Example

php_search_file.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?php
$strFileName = "shotdev/my.txt";
$objFopen = fopen($strFileName,"r");
while( !feof($objFopen) )
{
$Buffer = fgets($objFopen,4096);
if(strstr(strtolower($Buffer),strtolower('ShotDev')))
{
echo $Buffer."<br>";
}
}
fclose($objFopen);
?>
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_search_file.php

Screenshot

PHP Search Text File

PHP Search Text File
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (2 votes, average: 2.50 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.