1. 10 sentences 1. do not attach the register_globalON 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.
1. 10 sentences
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:
PHP code:
If ($ data [$ I] ['nickname']) {
$ Nickname = $ data [$ I] ['nickname'];
}
Else {
$ Nickname = $ data [$ I] ['IP'];
}
Can be written:
PHP code:
$ Nickname = $ data [$ I] ['nickname']? $ Data [$ I] ['nickname']: $ data [$ I] ['IP'];
3. good at organizing the if... else... loop
For example:
PHP code:
$ 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:
PHP code:
$ 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 as much as possible. if it is written like this, it is a headache:
PHP code:
$ Foo = $ _ post ['foo'];
$ Username = $ _ post ['user'];
$ Group = $ _ POST ['group'];
If ($ group = 'wheel ')
{
$ Username = $ username. 'wheel ';
}
The same code makes it easier to see:
PHP code:
$ Foo = $ _ post ['foo'];
$ Username = $ _ post ['username'];
$ Group = $ _ POST ['group'];
If ($ group = 'wheel ')
{
$ Username = $ username. 'wheel ';