【php开源代码栏目提醒】:网学会员鉴于大家对php开源代码十分关注,论文会员在此为大家搜集整理了“controller.php”一文,供大家参考学习
<?php
/* SVN FILE: $Id: controller.php 4409 2007-02-02 13:20:59Z phpnut $ */
/**
* Base controller class.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
* Copyright 2005-2007, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp Cake
PHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.controller
* @since CakePHP(tm) v 0.2.9
* @version $Revision: 4409 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2007-02-02 07:20:59 -0600 (Fri, 02 Feb 2007) $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Include files
*/
uses(DS . 'controller' . DS . 'component', DS . 'view' . DS . 'view');
/**
* Controller
*
* Application controller (controllers are where you put all the actual code)
* Provides basic functionality, such as rendering views (aka displaying templates).
* Automatically selects model name from on singularized object class name
* and creates the model object if proper class exists.
*
* @package cake
* @subpackage cake.cake.libs.controller
*
*/
class Controller extends Object{
/**
* Name of the controller.
*
* @var string
* @access public
*/
var $name = null;
/**
* Stores the current URL (for links etc.)
*
* @var string
* @access public
*/
var $here = null;
/**
* The webroot of the application
*
* @var string
* @access public
*/
var $webroot = null;
/**
* Action to be performed.
*
* @var string
* @access public
*/
var $action = null;
/**
* An array of names of models the particular controller wants to use.
*
* @var mixed A single name as a string or a list of names as an array.
* @access protected
*/
var $uses = false;
/**
* An array of names of built-in helpers to include.
*
* @var mixed A single name as a string or a list of names as an array.
* @access protected
*/
var $helpers = array('Html');
/**
* Parameters received in the current request, i.e. GET and POST data
*
* @var array
* @access public
*/
var $params = array();
/**
* POST'ed model data
*
* @var array
* @access public
*/
var $data = array();
/**
* Directory where controllers views are stored
* Normaly this is automatically set
*
* @var string
* @access public
*/
var $viewPath = null;
/**
* Variables for the view
*
* @var array
* @access public
*/
var $viewVars = array();
/**
* Web page title
*
* @var boolean
* @access public
*/
var $pageTitle = false;
/**
* An array of model objects.
*
* @var array Array of model objects.
* @access public
*/
var $modelNames = array();
/**
* Base url path
*
* @var string
* @access public
*/
var $base = null;
/**
* Layout file to use (see /app/views/layouts/default.thtml)
*
* @var string
* @access public
*/
var $layout = 'default';
/**
* Automatically render the view (the dispatcher checks for this variable before running render())
*
* @var boolean
* @access public
*/
var $autoRender = true;
/**
* Automatically render the layout
*
* @var boolean
* @access public
*/
var $autoLayout = true;
/**
* Array of components a controller will use
*
* @var array
* @access public
*/
var $components = array();
/**
* The name of the View class a controller sends output to
*
* @var string
* @access public
*/
var $view = 'View';
/**
* File extension for view templates. Defaults to Cake's conventional ".thtml".
*
* @var string
* @access public
*/
var $ext = '.thtml';
/**
* Instance of $view class create by a controller
*
* @var object
* @access private
*/
var $__viewClass = null;
/**
* The output of the requested action. Contains either a variable
* returned from the action, or the data of the rendered view;
* You can use this var in Child classes afterFilter() to alter output.
*
* @var string
* @access public
*/
var $output = null;
/**
* Automatically set to the name of a plugin.
*
* @var string
* @access public
*/
var $plugin = null;
/**
* Used to set methods a controller will allow the View to cache
*
* @var mixed
* @access public
*/
var $cacheAction = false;
/**
* Used to create cached instances of models a controller uses.
* When set to true all models related to the controller will be cached,
* this can increase performance in many cases
*
* @var boolean
* @access public
*/
var $persistModel = false;
/**
* Replaced with Controller::beforeFilter();
*
* @deprecated will not be av