Several ideas for PHP development-PHP Tutorial-php Tutorial

Source: Internet
Author: User
Several ideas of PHP development are recorded. 1. for rapid development, you can use the MVC framework such as CodeIgniter to make it very effective in rapid development. the MVC framework does not force you to write object-oriented code. for rapid development, you can consider using the MVC framework.

Using MVC frameworks such as CodeIgniter is very effective in rapid development. MVC frameworks do not force you to write object-oriented code. they only separate php code from html.

  • Clearly differentiate php and html code. it is advantageous in team collaboration that designers and programmers can work at the same time.
  • Object-oriented functions make maintenance easier.
  • Built-in functions do a lot of work and you do not need to write them again.
  • It is necessary to develop large applications.
  • Many suggestions, tips, and hack have been implemented by the framework.
2. setting error_reporting to 0 may not make everything better.

It is important to report E_FATAL errors.

Ini_set ('display _ errors ', 1 );
Error_reporting (~ E_WARNING &~ E_NOTICE &~ E_STRICT );

Note:

  1. The file '/path/to/errors.txt' that allows the web server to record error information should grant the web server write permission.
  2. This error log file must be independent. Otherwise, all the logs, including the apache web server logs and other error logs, will be mixed together.
  3. In addition, the error log file set for the current application should only record the error logs of the current application (it is possible that other applications are running on the web server ).
  4. Application Error logs should be stored in a directory of the current application so that system directories such as/var/log do not need to be searched.
  5. Do not set error_reporting to 0. This will prevent all occurrences from being recorded.

In addition, set_error_handler should be used to set a custom error handling method. For example, this unique function can record all errors to a file.

Set 'display _ errors = on' in php. ini of the development environment'

In php. ini of the development environment, enabling display_errors is very important (and do not rely on ini_set settings ). This is because ini_set is not allowed to run any errors that occur during compilation, which leads to a blank page without any error information being displayed.

Similarly, it is set to on in php. ini, but it is set to off in code, so the error will not be displayed when it occurs.

Set 'display _ errors = off' in php. ini of the product environment'

Do not rely on the code init_set ('display _ errors ', 0); because if a code error occurs during compilation, this statement will not be executed, the error message is immediately displayed to the customer.

3. Try development on Linux

If you have already developed on windows, you may need to try development on linux. My favorite Linux is Ubuntu. Although this is only one of the available development environments, I still strongly feel that the linux development environment is a better development environment.

PHP applications are usually deployed in the linux (LAMP) environment. However, similar development environments can help a robust application to run faster.

In Ubuntu, most development tools can be easily installed in the system through the installation package manager. In addition, you can set and run them with only a small amount of configuration. The most amazing thing is that these tools are free!

Http://www.bkjia.com/PHPjc/752337.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/752337.htmlTechArticle1. for rapid development, you can consider using the MVC framework such as CodeIgniter to make it very effective in rapid development. the MVC framework does not force you to write object-oriented code, it...

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.