MVC with PHP (ii) _php tutorial

Source: Internet
Author: User
MVC with PHP (a) bug problem is present, the biggest problem is the problem of the log system, and so on after this introduction I have all the correct program source packaging
Out, there is no change for the time being.
Let's take a look at how the controller instance is built in application.class.php:
PHP Code:--------------------------------------------------------------------------------
/**
* Execute function
*
* This type of only external interface
**/
Public Function Run ()
{
$this->parsepath ();
$this->checksecurity ($this->module, $this->action);
1. $controller = new $this->controllerclassname ();
2. $controller->{$this->action} ();
$this->writelog ($this->module, $this->action);
}
--------------------------------------------------------------------------------
Application This class is the only function that can be called after the instance, it analyzes the required controller class name based on the user's URL request, then instantiates the class (where it is labeled 1), and then invokes the action name obtained from the URL (labeled 2 above).
This is a simple example:
Url:http://localhost/?module=news&action=showlist
Application by parsing this URL to Controllerclassname=news, action=showlist, and then it will be in the file name containing the controller class (in application-> Getcontrollerfile (), and then instantiate the news
The controller class (where 1 is labeled) and then calls its action showlist (labeled 2).
Take a look at what's in newscontroller.php:
=============================================================
PHP Code:--------------------------------------------------------------------------------
/**
* FileName:newsController.php
* Introduce: News control category
*
* @author: Big bro
* @Email: teacherli@163.com
* @version $Id $
* @copyright 2004-10-26
**/
Include_once ("./controller/comm/controller.class.php");
Include_once ("./model/news/newsmodel.php");

Class Newscontroller extends Controller

http://www.bkjia.com/PHPjc/631836.html www.bkjia.com true http://www.bkjia.com/PHPjc/631836.html techarticle MVC with PHP (a) bug problem is present, the biggest problem is the problem of the log system, such as the completion of this introduction after I have all the correct program source package out, here is not ...

  • Related Article

    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.