PHP personal website set up a serial talk (i) _php Foundation
Source: Internet
Author: User
Here and you share the experience of setting up a personal website. The wrong place, please correct me!
Editing a debugging environment
Win98 local edit debugging, cool? First of the next omnihttpd proffesinal V2.06, installed on the PHP4BETA3 can be used. If you know more about HTML, recommend to use EditPlus, pretty good Oh! Otherwise have to use Dreamweaver first. Do you want to even have a database? Luckily, MySQL also has a for WIN32 version.
Two, first, a counter.
Their counter is always better than the foreign, Shing well! The current introduction of the counter source code is always that kind of refresh a long, unavoidably some self-deception, hehe. But let's first analyze how it works, and here is an example of a simple counter:
<php $countfile = "Count.txt";
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 do you make the counter more realistic? PHP4 gives us an easy way to use session-level variables. One into the page, first verify that the session count exists and equal to the value you want, not equal to the first, and then call the counting process, after the end of the conversation, you can say to count: Byebye you na!
But what if it's not PHP4? I wonder if you remember cookies? We can assume that a person's request for your Web page within 15 minutes (or other time) does not belong to a new number, so you can do a counting process exist in Inc, where each page references the visitor's access time to the cookie in the first entry. Each subsequent page is accessed to check the cookie's last access time value. Compare, if the difference is greater than 15 minutes to count, otherwise refresh time. (You don't even know how to use cookies, do you?) Oh, recommend a book "PHP Core Programming", Tsinghua version, check the function is enough, each function has a use example:-D)
However, just the counter is not beautiful to say, I guess you are certainly not satisfied, change the shape of the bar. Do a set of 0.jpg,1.jpg ... 9.jpg. Didn't you just read a string? First check the string length, enter your desired length (such as 5) minus the string length (remove the space after) a 0, and then from the beginning of a truncated number (in fact, or character), and ". jpg" combined after the output, the graphics counter is not out?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service