Important points to be aware of when using PHP for development

Source: Internet
Author: User
Tags call shell

Different technical platforms lead to different implementation methods. The same is Php. Small companies often choose win platforms, while large companies choose Unix-like platforms (Linux, freeBSD and other). Recently, I am learning PHP. In summary, I hope it will be useful to you.

 

Use of Linux

 

Now
The standard system is Linux + nginx + PHP + MySql
More and more large companies are using such configurations. Different configurations are the protocol of a company. For example, mounting is generally divided into two disks, /The following partition is used by the system for 10 Gb.
The remaining space is allocated to/home. I feel better about this. I used to draw too many items, and secondly, for secure login to the system. Now, for small companies or individuals, the approach is to directly use the account or
The practice of logging on directly with the password of the attacker to a relatively large company is to first log on to the relay intermediate server and then log on to the target server through the intermediate server, so that the account will be recorded and the security is relatively high, it is generally used now
Token and rsasecurid are used for password login, which improves overall security.

 

PHP calls shell commands

 

I haven't used PHP to call shell to execute some extra tasks before. Now I often use it, so that I can do other things except the script, which is more convenient.

 

Editing
For coding habits, every company and team often use different codes. In particular, different programming ides lead to different coding specifications and different conventions, however, the overall habits have passed through the entire team
The individual personnel's decision was settled. This was not strictly required by the original small company. Now, this is also the case. It seems that this has a lot to do with the team culture, this team has been getting along for a long time. Naturally
Familiar.

 

Function return value

 

Generally, false is returned for failed return values.
The Int value is returned. If it is data, array or other values are returned. For the current function, due to the use of memcache, many cache operations in the function are used.
The return value is obtained from the cache first. If it is not obtained from the database, it is written to the cache and then the data is returned.

 

The original writing method for processing data writing is:
In $ _ Post & $ _ Get
The data is then processed by addslashes. The current practice is to directly receive the data, determine whether the data meets the requirements, then splice the SQL statement, and then execute the SQL statement
Mysql_escape_string processing, and then use htmlspecialchars to process the data when reading the data, so that there is no problem.

 

About queue Distribution

I have used MQ to distribute memcache data. I have not yet figured out the specific implementation. I have to consult with you.

 

Understanding of PHP error levels

 

Originally, for error levels, it was relatively lightweight during development. e_all | e_strict is now replaced with e_all &~ E_strict is a good habit of variable definition, and Initialization is necessary during use.

Control over the prevention of illegal information and advertisements by users and the frequency of user behavior

 

Spam systems are used to control illegal advertisements published by users to prevent problems and restrict user behaviors, so as to prevent excessive resource control, for variables in the system, the unique ID of auto-increment cannot be used. encryption is required and the returned system information is obtained by others. including user ID and data information Id encryption. Source: bean sprout blog, address: http://www.aichengxu.com/article/php/370_1.htmlreserve source link, which is the start of source sharing.

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.