15 hours ---- from modifying programs to some of your own programs

Source: Internet
Author: User
This article is an original article by the wind, with copyright. this is a forum from www.iphp.org. Please keep this information for Internet reprinting. for non-network reprint, contact me. it is not easy for my webmaster to write things on his own. In order to give me the courage and motivation to continue writing, please do not delete this description during reprinting. this is the first article, and I will find time to write future things.
Many of my friends have long-term knowledge of php and stay on modifying other people's programs. They are lazy and progressive because they can be modified. or when I bought a book and read it, I found that php functions were so invincible that I was stunned when I saw the function library. and so on. I myself belong to the latter. this article is intended for lazy people who spend time learning php but want to do something on their own.
Later, I attended a secondary school. The teacher told me that I had to take the final exam, so I was forced to write simple code by myself.
Therefore, this article is intended for users who can modify the html of a program, but cannot modify the program structure. It has the basic program Foundation: can understand if and else. enough, or suitable for people with the same foundation. experts can go away. so far, I still need to check the manual for using common functions and write junk code again.
Okay, let's get down to the first stage.
            
Friends who can modify the program are regarded as top-notch characters on the webpage. if I start from what is a variable, it will inevitably delay your time. I am also engaged in text collection, so we can start with a detailed analysis of a part of the program. the program is very simple. There are only a few simple judgments. I will write the program description in Invincible detail.
Quote:
If you do not understand where it is, please paste it with me and tell me that I will modify it as soon as possible or email me. My email address is rainboy # tom.com. Please do not send me a spam, I am bored with spam.
Next we will start by profiling a simplest counter
The counter function is to refresh the page once and add one to the number.
The procedure is as follows:
Code:
[Copy to clipboard]
<?
$ Datafile = "data.txt ";
$ Fp1 = fopen ($ datafile, "r ");
$ Num = fgets ($ fp1, 10 );
$ Num = trim ($ num );
Fclose ($ fp1 );
Echo "you are the". $ num. "guest ";
$ Fp2 = fopen ($ datafile, "w ");
$ Num = $ num + 1;
Fputs ($ fp2, "$ num ");
Fclose ($ fp2 );
?>

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.