I. 10 experiences 1. do not attach the register_global = ON environment. from the day when you first learned how to configure the php runtime environment and even do not understand the impact of register_global ON/off on yourself, we should set it to OFF.2. before writing a program, let's see how to use it.
I. 10 experiences
1. do not attach the register_global = ON environment. from the day when you first learned how to configure the php runtime environment and even do not understand the impact of register_global ON/off on yourself, it should be set to OFF bravely.
2. check how to use error_reporting before writing a program.
3. if you don't understand it, you are right. but you need to check the manual before that.
4. of course, you need to understand the application manual. When you cannot find the answer in the manual, you should consider the search engine on the network.
5. after learning php mysql, do not yell at writing forum or XXX. You must understand that just learning to write Chinese characters does not show that you can write poems.
6. when learning web programming, you should first familiarize yourself with html.
7. try to reply to the title of a newbie if you don't know what you understand, and if you don't know others, you will be complacent. if you drop a "simple, that is the basic thing", you have to go further.
8. thinking is a good habit. if you don't start writing it, it's just an illusion and there is nothing.
9. write a program. if you feel satisfied, read it again in a week, you may think it should change.
10. Take a look at other people's programs and find out their shortcomings or strengths.
II. different requirements
1. be good at application "reference", which can directly affect program efficiency.
2. it is good at using ternary computation subtasks to make programs more streamlined and efficient.
For example:
If ($ data [$ I] ['nickname'])
{
$ Nickname = $ data [$ I] ['nickname'];
}
Else
{
$ Nickname = $ data [$ I] ['IP'];
}
Can be written:
$ Nickname = $ data [$ I] ['nickname']? $ Data [$ I] ['nickname']: $ data [$ I] ['IP'];
3. good at organizing if... else...
For example:
$ Ext_name = strtolower (str_replace ('.', '', strrchr ($ upfilename ,'.')));
If (! Empty ($ type ))
{
If (! Strpos ($ type, $ ext_name ))
{
Echo 'Please upload the file of $ type form .';
Exit ();
}
}
The above code should be written as follows:
$ Ext_name = strtolower (str_replace ('.', '', strrchr ($ upfilename ,'.')));
If (! ($ Type = '') & strpos ($ type, $ ext_name) = false)
{
Echo 'Please upload the file of $ type form .';
Exit ();
}
4. try to clear your code
If it is written like this, it is a headache:
$ Foo = $ _ post ['foo'];
$ Username = $ _ post ['user'];
$ Group = $ _ POST ['group'];
If ($ group = 'wheel '){
$ Username = $ username. 'wheel ';
}
The same code makes it easier to see:
$ Foo = $ _ post ['foo'];
$ Username = $ _ post ['username'];
$ Group = $ _ POST ['group'];
If ($ group = 'wheel ')
{
$ Username = $ username. 'wheel ';
}
Of course, you should write it as follows:
$ Foo = & $ _ POST ['foo'];
$ Username = $ _ POST ['group']! = 'Wheel '? $ _ POST ['username']: $ _ POST ['username']. 'wheel ';