I. 10 sentences 1. Do not rely on the environment of register_global = ON, from you just know how to configure the PHP running environment, even don't understand that register_global's on / off will have any effect on yourself, you should set it up to Off.2. See how to use error_reporting.3 before writing the program. If you don't understand, ask it it is right, but you need to check the manual before that. 4. Of course, you need to know how to use the manual. When you can't find an answer on your manual, you should consider the search engine on your network. 5. After learning the PHP MySQL, don't call the Forum and write xxx. To understand, just learn to write Chinese characters does not mean that you have the ability to write poetry. 6. When learning Web programming, you should first know the html friend. 7. After a little ability, try to answer a novice problem, don't see you know what you know, don't understand, you will be self-satisfied, throw a "simple, that is the basic thing". 8. Thinking is a good habit, you don't move your hand, you will wait for the empty ideas, and there is no. 9. Write a program, if you feel very satisfied, look at it again, maybe you will think that it should change 10. There are free to see someone else's procedures, find out the insufficient or advantages of others, you can quasi. II. Each takes the required 1. Good at "reference", which can directly affect the efficiency of the program. 2. Be good at using the three-yuan operator, allowing the process to be more efficient. such as:
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 tissue IF ... Else ... Back to ring, for example:
PHP code:
$ ext_name = strtolower (str_replace (",", strrchr ($ upfilename, "."))))))))
IF (! Empty ($ TYPE))
{
IF (! STRPOS ($ TYPOS ($ TY, $ EXT_NAME))
{
Echo "Please Upload the file of $ type form.";
exit ();
}
}
You should write this:
PHP code:
$ ext_name = strtolower (str_replace (",", strrchr ($ upfilename, "."))))))))
IF ($ TYPE === ') && Strpos ($ TY, $ ext_name) === false)
{
Echo "Please Upload the file of $ type form.";
exit ();
}
4. Try to let your code clearly write this, it is more headache:
PHP code:
$ foo = $ _ post ["foo"];
$ usrname = $ _ post ["user"];
$ group = $ _ post ["group"];
IF ($ group == "wheeel") {
$ usrname = $ usrname. "Wheel";
}
The same code, this is more comfortable:
PHP code:
$ foo = $ _POST ["foo"]; $ usrname = $ _POST ["username"];
$ group = $ _POST ["group"];
IF ($ group == "wheei")
{
$ usrname = $ usrname. "Wheel";
}
Of course, after a certain basis, you should be written:
PHP code:
$ foo = & $ _ post ['foo'];
$ usrname = $ _POST ["group"]! = 'WHEEL'? $ _POST ["Username"]: $ _POST ["username"]. 'Wheel';
5. Write a specified MySQL statement. Fields and table names use "` "to avoid the impact of reserving words. If you see a SQL Query below, people will compare headache:
PHP code:
$ query = "SELECT` Flash_comment`.`content`, `flash_comment`.`.` flash_comment`.date`, `flash_comment`.`.`,` sgflash`..` Fid` from `flash_comment` =` pROMENT`.````` = `sgflash`.` =` sgflash`. `=` sgflash`.`f_name `) WHERE` Flash_comment`.`p_no`! = '' Order by `flash_comment`.date`
The same Query, writing this way, it is much more clear:
PHP code:
$ query = "SELECT` Flash_comment`.`content`, `flash_comment`.`.` flash_comment`.date`, `flash_comment`.`.`,` sgflash`..` FID`
From `Flash_comment`
LEFT JOIN `Product` ON (` Flash_comment`.`` = `product`.`P_no`
Left join `sgflash` =` sgflash`.`F_name`)
WHERE `flash_comment`.`p_no`! = '' ORDER BY` Flash_Comment`.date`