1 Counter Fri Jan 21, 2011 6:39 pm
Unknown Data
Registered Member
Counter Learn PHP - Part 6 |
We are now starting creating our counter. It's actually very simple. Try take a look at the fully source and I'll later explain it to you.
$count = file("visits.txt"); Here are we reading our file and the content is saved in a array. $count_gl = $count[0]; The first line in our arrays is saved in the variable count_gl $new_count = ++$count_gl; After that are we counting our variable count_gl up with one. $data = fopen("visits.txt","w"); Here are we opening up for our data. The file visits.txt is opened in a writting statemnt (w). $write = fwrite($data,$new_count); Here is the new value written. fclose($data); When we are finish with the data, are we then closing it. echo Writting some content like HTML, CSS etc. and the status for the counter. That was actually just it. Hope you've learned what you need to learn, about some simple things in the PHP library. |
Notice : This tutorial is copyrighted by WebArtz Forum. You may not publish it on anywhere without written permission from the administrators. |