Let's talk about the experience of setting up a personal website. Please correct me if you are not in the wrong place.
An edit debugging environment
Win98 local editor debugging, cool? First the next omnihttpd proffesinal V2.06, installed on the PHP4BETA3 can be used. If you know more about HTML, recommend using EditPlus, pretty good Oh! Otherwise you have to use Dreamweaver first. And even the database? Fortunately, MySQL also has a for WIN32 version.
Two, first, a counter.
Their counter is always better than the foreign, appreciating! The current introduction of the counter source code is always the kind of refreshing a bit long, inevitably some self-deception, hehe. But let's just analyze how it works, here's an example of a simple counter:
if (file_exists ($countfile))
{$fp =fopen ($countfile, "r+");
$count =fgets ($FP, 5); $count +=1; Rewind ($FP);
Fputs ($FP, $count, 5);
Fclose ($FP);
}
Else
{
$FP =fopen ($countfile, "w");
$count = "1";
Fputs ($FP, $count, 5);
Fclose ($FP);
};
?>
This counter has a nickname, called a brush on the long ^_^. So, how can we make the counter more realistic? PHP4 provides us with a simple way to use session-level variables. In the page, first verify that the session count is present and equal to the value you want, not equal to the first, and then call the count process, after the end of the session, you can say to count: Byebye!
But what if it's not PHP4? I wonder if you remember the cookie? We can assume that a person's request for your page within 15 minutes (or another time period) is not a new one, so that you can do a counting process that exists in Inc, which is quoted on each page, and the access time is sent to the cookie when the visitor first enters. The last access time value of the cookie is checked when each page is accessed later. Compare, if the difference is more than 15 minutes count, otherwise the time refresh. (You don't even know how to use cookies, do you?) Hehe, recommend a book "PHP Core Programming", Tsinghua version, check function is enough, each function has a use example:-D)
However, just the counter is not beautiful, it is estimated that you are not satisfied with, change a graphic bar. Do a set of 0.jpg,1.jpg ... 9.jpg. Didn't you just read it in a string? First check the string length, enter your desired length (such as 5) minus the string length (after removing the space) of 0, and then from the beginning of a truncated number (in fact, the character), and ". jpg" after the combination of output, the graphics counter is out?
Well, the counter for each person is already quite perfect.
To be Continued ...
http://www.bkjia.com/PHPjc/316039.html www.bkjia.com true http://www.bkjia.com/PHPjc/316039.html techarticle Let's talk about the experience of setting up a personal website. Please correct me if you are not in the wrong place. An editing debugging environment Win98 local editing debugging, cool? First the next omnihttpd Proffesina ...