$fp = fopen( $myFile, "r" );
//if echo $fp => I GOT NULL
fclose($fp);
But if I do file_get_contents($myFile); I got the string data of that file.
My file ( fedora os )
-rw-r--r-- 1 apache appli 104 2 nov. 12:54 12_62_xxx.log
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
$fpis a handle, it’s not some real data from the file. You can use this handle in other funcitons, such asfreadorfclose.file_get_contentsinternally opens the file, reads it, closes the file and returns the string. That’s why when you print the result of the last one you get the file’s contents.Try
echo fgets($fp)and see what you get.