ThinkPHP3.2.3 was a popular PHP development framework in the past. Now, although in addition to versions 5 and 6, many projects still use ThinkPHP3. The letter functions in ThinkPHP3 are a type of functions that start with letters. They have very rich functions, including string processing, file processing, date-time processing, and HTTP protocol processing.
A: Instantiated multi-layer controller Format: [Resource://][Module/] Controller
/** * Instantiated multi-layer controller Format: [Resource://][Module/] Controller * @param string $name Resource address * @param string $layer Control layer name * @param integer $level Controller hierarchy * @return Controller|false */ A($name,$layer='',$level='')
B: Execute a certain behavior
/** * Perform a certain action * @param string $name behavior name * @param string $tag tag name (behavior class does not need to be passed in) * @param Mixed $params Parameters passed in * @return void */ B($name, $tag='',&$params=NULL)
C: Obtain and set configuration parameters Support batch definition
/** * Get and set configuration parameters Support batch definition * @param string|array $name configuration variable * @param mixed $value configuration value * @param mixed $default Default * @return mixed */ C($name=null, $value=null,$default=null)
D: Instantiated model class Format [Resource://][Module/] Model
/** * Instantiated model class Format [Resource://][Module/] Model * @param string $name resource address * @param string $layer Model layer name * @return Model */ D($name='',$layer='')
M: Instantiate a Model without a model file
/** * Instantiate a Model without a model file * @param string $name Model name Supports specifying basic models, such as MongoModel:User * @param string $tablePrefix table prefix * @param mixed $connection Database connection information * @return Model */ M($name='', $tablePrefix='',$connection='')
E: Exception processing
/** * Exception throwing * @param string $msg Exception message * @param integer $code exception code default is 0 * @return void */ E($msg, $code=0)
F: Fast file data reading and saving for simple types of data Strings, arrays
/** * Fast file data reading and saving For simple type data Strings, arrays * @param string $name cache name * @param mixed $value cache value * @param string $path cache path * @return mixed */ F($name, $value='', $path=DATA_PATH)
G: Recording and counting time (microseconds) and memory usage
/** * Record and count time (microseconds) and memory usage *How to use: * <code> * G('begin'); // Record start mark bit * // ... interval running code * G('end'); // Record end tag bit * echo G('begin','end',6); // Statistical interval running time is accurate to 6 digits after the decimal * echo G('begin','end','m'); // Statistics the interval memory usage * If the end tag bit is not defined, the current tag bit will be automatically used as the tag bit. * The MEMORY_LIMIT_ON constant is true to be valid * </code> * @param string $start Start tag * @param string $end end tag * @param integer|string $dec decimal places or m * @return mixed */ G($start,$end='',$dec=4)
I: Get input parameters Support filtering and default values
/** * Get input parameters Support filtering and default values *How to use: * <code> * I('id',0); Get id parameters Automatically judge get or post * I('','','htmlspecialchars'); Get $_POST['name'] * I('get.'); Get $_GET * </code> * @param string $name The name of the variable supports specified types * @param mixed $default Default when it does not exist * @param mixed $filter parameter filtering method * @param mixed $datas Additional data source to get * @return mixed */ I($name,$default='',$filter=null,$datas=null
L: Get and set language definitions (case insensitive)
/** * Get and set language definitions (case insensitive) * @param string|array $name Language variable * @param mixed $value Language value or variable * @return mixed */ L($name=null, $value=null)
N: Set and get statistics
/** * Set and get statistics *How to use: * <code> * N('db',1); // Record the number of database operations * N('read',1); // Record the number of reads * echo N('db'); // Get all operations in the current page database * echo N('read'); // Get the number of times the current page is read * </code> * @param string $key Identify the location * @param integer $step step value * @return mixed */ N($key, $step=0,$save=false)
R: Operation method for remote call controller URL parameter format [Resource://][Module/] Controller/Operation
/** * Operation method for remote call controller URL parameter format [Resource://][Module/]Controller/Operation * @param string $url call address * @param string|array $vars call parameters Support strings and arrays * @param string $layer Name of the control layer to be called * @return mixed */ R($url,$vars=array(),$layer='')
S: Cache Management
/** * Cache management * @param mixed $name cache name, if cache setting is performed for array representation * @param mixed $value cache value * @param mixed $options cache parameters * @return mixed */ S($name,$value='',$options=null)
T: Get template file Format Resource://module@theme/controller/operation
/** * Get template file Format Resource://module@theme/controller/operation * @param string $name template resource address * @param string $layer View layer (directory) name * @return string */ T($template='',$layer='')
U: URL assembly supports different URL modes
/** * URL assembly supports different URL modes * @param string $url URL expression, format: '[Module/Controller/Operation#Anchor point@Domain Name]? Parameter 1=Value 1&Parameter 2=Value 2...' * @param string|array $vars passed in parameters, supporting arrays and strings * @param string $suffix pseudo-static suffix, default to true to obtain configuration value * @param boolean $domain Whether to display the domain name * @return string */ U($url='',$vars='',$suffix=true,$domain=false)
W: Rendering output Widget
/** * Rendering output Widget * @param string $name Widget name * @param array $data Parameters passed in * @return void */ W($name, $data=array())
This is the end of this article about all the single-letter methods of ThinkPHP3.2.3. This is the end of this article. For more related contents of ThinkPHP3.2.3, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!