Read the content of the Php file
source link: https://www.codesd.com/item/read-the-content-of-the-php-file.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Read the content of the Php file
I am trying to read the upper most comments of a style sheet using php, what i want is on/ce the comments get over php should stop reading that file let me show you my code
$handle = fopen($filename,"r");
if ($handle)
{
while (($file = fgets($handle, 4096)) !== false)
{
if($file != '*/')
{
echo $buffer.'<br />';
}
else
{
break;
}
}
}
What i am trying to do is reading the file line by line and the movement my line is equal to the sign of ending css comments it should not run that while statement but that is not working right now
how about adding trim, to deal with whitespace & the line ending "\r\n"s
$handle = fopen($filename,"r");
if ($handle)
{
while (($file = fgets($handle, 4096)) !== false)
{
if (trim($file) == '*/') {
break;
}
echo $buffer.'<br />';
}
}
Related Articles
The AJAX variable does not read the PHP file?
Read the .php file without applying the HTML and PHP tags in the result
Reading the php file and mysql search
how to read the php file version of the file?
Moves all text in the .php file to Array
How to get html generated content from a php file instead of including the file
Piping the contents of the PHP file to the PHP command in CLI
Reading the last file created php
Get HTML content from the php file, after being processed
include the contents of the php file
php reads the text file and compares it with the user input
reading the csv file in php
Draw IMAGE in the PHP file
Sending javascript data to the php file
Strange string behavior after reading the text file in python
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK