fclose()
Moderator: General Moderators
-
Grammatron
- Forum Newbie
- Posts: 4
- Joined: Mon Feb 09, 2004 1:52 pm
fclose()
I keep getting fclose Warnings on my site: http://207.36.204.49/gallery/disney/vintagemickey/ Everything seems to work fine regardless and if I remove the fclose line in the code the warnings go away. However I was wondering what is causing them so I can fix the problem instead of just making the warning go away.
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
-
Grammatron
- Forum Newbie
- Posts: 4
- Joined: Mon Feb 09, 2004 1:52 pm
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
try using a different variable name for the fgets()...
Code: Select all
$title = fopen('title.txt','r');
$title2 = fgets($title, 4096);
fclose($title);
$thumbs = fopen('thumbs.txt','r');
$thumbs2 = fgets($thumbs, 4096);
fclose($thumbs);
$big = fopen('big.txt','r');
$big2 = fgets($big, 4096);
fclose($big);Well you are reasigning the variables to the output. Since I am assuming you want to use the fgets() info you might want to do something like this:
Edit
Damn, you beat me to it
Code: Select all
<?php
$title_handle = fopen('title.txt','r');
$title = fgets($title_handle, 4096);
fclose($title_handle);
$thumbs_handle = fopen('thumbs.txt','r');
$thumbs = fgets($thumbs_handle, 4096);
fclose($thumbs_handle);
$big_handle = fopen('big.txt','r');
$big= fgets($big_handle, 4096);
fclose($big_handle);
?>Damn, you beat me to it
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
-
Grammatron
- Forum Newbie
- Posts: 4
- Joined: Mon Feb 09, 2004 1:52 pm
-
Grammatron
- Forum Newbie
- Posts: 4
- Joined: Mon Feb 09, 2004 1:52 pm
I take it back. Your solution worked, I just found where else the code
needs to change
So, thank you very much!
Code: Select all
$title = fopen('title.txt','r');
$title_2 = fgets($title, 4096);
fclose($title);Code: Select all
$add_text = array( 'txt_title' => $title_2 ,
'txt_thumbs' => $thumbs_2 ,
'txt_big' => $big_2 ,
);