Zend framework basic tutorial 3-create index. php

Source: Internet
Author: User
As you know, you need an index. php file in the Web root directory. This file is used to process all requests on the page. It is used to set the application Program Running environment, ZF control system, and then start to execute the program. This is the frontend control mode. Create a file named "index. php" in the web_root folder, and enter Code
 1 <? PHP
2 Error_reporting ( E_all | E_strict );
3 Ini_set ('Display _ errors ', True );
4 Date_default_timezone_set ('Europe/London ');
5
6 $ Rootdir = Dirname ( Dirname ( _ File __ ));
7 Set_include_path ( $ Rootdir . '/Library'. path_separator. Get_include_path ());
8
9 Require_once 'Zend/controller/front. php ';
10 Zend_controller_front: Run ('../application/controllers ');
11
12 ?>
Now let's take a look at more details of this file. Line 2-4 is used to set the system environment. The third line ensures that all errors or notes are printed. The fourth line is used to set the Default Time Zone ( I personally prefer to set the configuration information in the config file.) Include_path () is the requery (), include () and fopen_with_path () Methods to set the path for file search. You can set it in the PHP. ini file, but we don't have. You can use set_include_path (), just like Row 7. This is a boot file, and the core code is line 9-10. This initializes and calls the front-end controller. It distributes requests to the actions controller.

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.