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




