Windframework Basic Learning to create an application

Source: Internet
Author: User
Tags php class root directory

Create an application directory file

We create a folder in the Web's root directory (/var/www or elsewhere), named HelloWorld. Unzip the downloaded frame and place it in the application directory. Create a good directory structure as follows:

    • /var/www/helloworld/wind/Framework Directory
    • controller/Application Controller directory, business code placed in this directory
    • controller/indexcontroller.php application controller with default access
    • template/page Template Catalog
    • template/index.htm template file
    • index.php Portal Script File
    • Edit Entry Script index.php

Create the portal script index.php in the application directory, its main task is to load the frame and start the application. The code is as follows:

require_once ('.. /.. /wind/wind.php ');
Wind::application()->run();

PS: Of course, you can also set the error level in the index.php, Wind_debug mode and so on. Related content will be described later

Create indexcontroller.php

The

Creates the controller/directory under the application directory. The controller directory is the directory that is stored by the Windframework default-defined application controller, and we can change the access path of the application by manually configuring it. Create the Indexcontroller.php class file under the controller/directory we created. The contents of the file are as follows:

<?php  /**  * the last known user to change this file in the repository < $L AstChangedBy:long.shi $>  *   @author   Qiong Wu  papa0924@gmail.com> *    *   @package  */ class  indexcontroller extends  Windcontroller { public function  run   { echo   ' Hello World '   }  }   

The file name and class name are the same in Windframework, which is somewhat similar to Java. Windframework provides two types of application controllers ' Windsimplecontroller ', ' Windcontroller '. Here we inherit from ' Windcontroller ', the difference between the two application controllers, which will be specifically described later.

Run

At this point, our Hello World application has been completed. Quickly visit our Hello world through the browser:

http://localhost/helloworld/index.php

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.