Several ideas of PHP development _php Tutorial

Source: Internet
Author: User
Tags blank page codeigniter

1. If you want to develop quickly, consider using the MVC framework

Using an MVC framework like CodeIgniter is very effective in rapid development, and the MVC framework does not force you to write object-oriented code that separates PHP code from HTML.

    • A clear distinction between PHP and HTML code is beneficial in team collaboration, where designers and programmers can work together.
    • Object-oriented design functions make it easier to maintain.
    • The built-in functions do a lot of work and you don't need to write them again.
    • The development of large applications is necessary.
    • Many suggestions, tricks, and hack have been implemented by the framework.

2. Setting error_reporting to 0 may not be everything.

Error Reporting E_fatal error is very important.

Ini_set (' display_errors ', 1);
Error_reporting (~e_warning & ~e_notice & ~e_strict);

Attention:

    1. The file '/path/to/errors.txt ' that allows the Web server to log error messages should have writable permissions on the Web server.
    2. This error log file should be separated. Otherwise all the logs, including the Apache Web server logs, and other error logs will all be mixed together.
    3. Also, the error log file that is set for the current application should only record the error log for the current application (it is possible that other applications are running on the Web server).
    4. The application's error log should be placed in a directory of the current application, so that a system directory like/var/log no longer needs to be searched.
    5. Do not set error_reporting to 0. This will make everything that happens is not recorded.

In addition, Set_error_handler should be used to set a user-defined error handling method. For example, this unique feature can record all errors into a file.

Setting ' Display_errors=on ' in the php.ini of the development environment

In the php.ini of the development environment, it is important to enable Display_errors permissions (and do not rely on ini_set settings). This is because any compile-time errors do not allow Ini_set to run, which causes a blank page to appear without any error messages.

Similarly, the php.ini is set to ON, but it is set to off in the code, so the error does not appear when it occurs.

Set ' Display_errors=off ' in the php.ini of the product environment

Do not rely on code init_set (' Display_errors ', 0); Because if the compile-time code is wrong, then this statement will not be executed, and the error message will be displayed to the customer immediately.

3. Try to develop on Linux

If you are already developing on a Windows system, you may want to try out the development on Linux. My favorite Linux is Ubuntu. Although this is only one of the optional development environments, I still strongly feel that the Linux development environment is a better development environment.

PHP applications are typically deployed in a Linux (LAMP) environment. However, a similar development environment can help a robust application run faster.

On Ubuntu systems, most development tools can be easily installed into the system by installing the Package Manager. In addition, they can be set up and run with only a small amount of configuration. And most wonderful of all, these tools are free!

http://www.bkjia.com/PHPjc/752337.html www.bkjia.com true http://www.bkjia.com/PHPjc/752337.html techarticle 1. If you want to develop quickly, consider using an MVC framework like CodeIgniter to be effective in rapid development, and 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.