Having issues with going from fopen -> serialize
Posted: Sun Jul 20, 2003 11:06 pm
I've got this flatfile link script I'm working on... and I was told that serialize() would be a good thing to try to use. I think I understand the terminology behind the whole idea... and I've checked out php.net and google and what have you.
So I thought I'd apeal to the general population seeing how there are a lack of tutorials/help on the subject.
Right now I have the file set as:
number|user|link|name|hits
And I can read the text file and thats all ok. Its just trying to overwrite a certain entry to update the # of hits that gives me an issue.
I was just wondering if someone could give me an idea on modifing this to suit serialize() or point me to a resource that might deal with it or something.
Thanks,
d3.
So I thought I'd apeal to the general population seeing how there are a lack of tutorials/help on the subject.
Right now I have the file set as:
number|user|link|name|hits
And I can read the text file and thats all ok. Its just trying to overwrite a certain entry to update the # of hits that gives me an issue.
Code: Select all
<?php
// This is what I have for the normal text file.
$fp = fopen($filename, "r");
$file_contents = fread($fp, filesize($filename));
fclose($fp);
$line = explode("\n", $file_contents);
$i = 0;
$size = sizeof($line) - 1;
?>Thanks,
d3.