Provides various official and user-released code examples and code reference. You are welcome to share some common methods or variables in your learning projects in a single module, called a public module.
The public module directly inherits the Action class, and other modules inherit the public module.
So how can we prevent public modules from being directly accessed externally?
For example, a public module CommonAction is defined.
class CommonAction extends Action {
public $uid;
……
}Other modules:
Class UserAction extends CommonAction {
Function index (){
Echo $ this-> uid; // you can directly use public variables here
}
......
}However, if an operation is defined in CommonAction and is not processed, the visitor can directly use/index. php/Common/operation name.
In general, public modules do not require direct access from visitors.
In this case, you only need to make a simple process.
1. In the UserAction. class. php file:
Define ("INC", 1); // defines INC Constants
Class UserAction extends CommonAction {
......
}
?>2. In CommonAction. class. php:
// Determine whether there is a defined INC. If not, exit directly.
If (! Defined ("INC ")){
Exit ('Access Denied ');
}
Class CommonAction extends Action {
......
}
?>
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB