rapidphp 1.1.0-Create your first app

Source: Internet
Author: User

Create a controller

Create the Controller directory under the application/directory and then create the Basecontroller in the controller directory to inherit the controller//NOTE: Basecontroller function is the global controller common Method Library

File name: BaseController.class.php

<?   use rapid\core\controller;  Use  classextends  controller{    // public method Library }

Then create Indexcontroller, inherit Basecontroller

<? phpnamespace Application\controller;  Use  classextends  basecontroller{public    function indexaction ()
{
echo "rapidphp frame";
}}

Simple control before the creation is complete, the following configuration routing, find the rapid/config/routing/directory, there are two files

App.inc.php//Controller method configuration, which allows routing calls to methods that are not allowed to be configured

<?phpnamespace rapid\config\routing; UseApplication\controller\indexcontroller; UseRapid\config\constants\app; Userapid\config\constants\app\routing;/** * Can access the class, interface, do not declare then do not have permission to access*/return Array(Indexcontroller::class=Array(        ' Indexaction ' =Array(Routing:: Method_type = app::app_request_get,//request type GET request        ),    ));

uri.inc.php//Routing address configuration

<? phpnamespace rapid\config\routing;  Use Application\controller\indexcontroller;  Use rapid\config\constants\app\routing; /*  */returnarray(    array(        Routing:: Class_name = Indexcontroller::class, routing::app_name = ' indexaction '    );

OK, Access//index/index.htm/index.html/index.php can be accessed in, to the Times, our first rapidphp app is created.

rapidphp 1.1.0-Create your first app

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.