About thinkphp built-in functions detailed D, F, S, C, L, A, I

Source: Internet
Author: User
Tags php tutorial prototype definition vars
Single-letter functions D, F, S, C, L, A, I they are defined in the thinkphp core thinkphp/mode/api/functions.php this file.

Let me explain their functions separately:

D () Load model class

M () Load model class

A () Load action class

L () Get the language definition

C () Get configuration value usage is C ("Fill in the subscript of the array in the configuration file")

S () global cache configuration usage S ("Here is the equivalent of a unique identity")

F () Fast file data reading and saving for simple type data strings, arrays

I () Quickly create an object instance

Included here: thinkphp prototype definition of all functions built in

1 
 Php2 3 /** 4 * Think API mode function library5 */ 6 7 /** 8 * Get and set configuration parameters support Batch definition9 * @param string|array $name configuration VariablesTen * @param mixed $value configuration values One * @param mixed $default default value A * @return Mixed - */  - functionC$name=NULL,$value=NULL,$default=NULL) {}  the  - /**  - * Load profile support format conversion supports only one-level configuration - * @param string $file profile name + * @param string $parse Configuration parsing method Some formats require the user to parse themselves - * @return void + */  A functionLoad_config ($file,$parse=conf_parse) {}  at  - /**  - * Throw exception handling - * @param string $msg exception message - * @param integer $code exception code defaults to 0 - * @return void in */  - functionE$msg,$code=0) {}  to  + /**  - * Recording and statistical time (microseconds) and memory usage the * How to use: *  *   36  * G('begin'); // 记录开始标记位  37  * // ... 区间运行代码  38  * G('end'); // 记录结束标签位  39  * echo G('begin','end',6); // 统计区间运行时间 精确到小数后6位  40  * echo G('begin','end','m'); // 统计区间内存使用情况  41  * 如果end标记位没有定义,则会自动以当前作为标记位  42  * 其中统计内存使用需要 MEMORY_LIMIT_ON 常量为true才有效  43  *   - * @param string $start start tag $ * @param string $end end tag $ * @param integer|string $dec decimal digits or M - * @return Mixed - */  the functionG$start,$end='',$dec=4) {}  - Wuyi /**  the * Get and set Language definitions ( case insensitive) - * @param string|array $name language variables Wu * @param string $value language value - * @return Mixed About */  $ functionL$name=NULL,$value=NULL) {}  -  - /**  - * Add and Get page trace records A * @param string $value variable + * @param string $label tag the * @param string $level log level - * @param boolean $record Whether logs are logged $ * @return void the */  the functionTrace$value= ' [Think] ',$label='',$level= ' DEBUG ',$record=false) {}  the  the /**  - * Compiling files in * @param string $filename file name the * @return String the */  About functionCompile$filename) {}  the  the /**  the * Get input parameters to support filtering and default values + * How to use: -  *   80  * I('id',0); 获取id参数 自动判断get或者post  81  * I('post.name','','htmlspecialchars'); 获取$_POST['name']  82  * I('get.'); 获取$_GET  83  *   - * @param string $name The name of the variable supports the specified type - * @param The default value when the mixed $default does not exist the * @param mixed $filter parameter filtering method the * @return Mixed the */  the functionI ($name,$default='',$filter=NULL) {}  -  the /**  the * Set up and get statistical data the * How to use:94  *   95  * N('db',1); // 记录数据库操作次数  96  * N('read',1); // 记录读取次数  97  * echo N('db'); // 获取当前页面数据库的所有操作次数  98  * echo N('read'); // 获取当前页面读取次数  99  *   - * @param string $key identify the location101 * @param integer $step step value102 * @return Mixed103 */ 104 functionN$key,$step=0,$save=false) {}  the 106 /** 107 * String naming style conversion108 * Type 0 convert Java style to C style 1 convert c style to Java style109 * @param string $name strings the * @param integer $type conversion type111 * @return String the */ 113 functionParse_name ($name,$type=0) {}  the  the /**  the * Optimized require_once117 * @param string $filename file address118 * @return Boolean119 */  - functionRequire_cache ($filename) {} 121 122 /** 123 * Case-sensitive file existence judgment124 * @param string $filename file address the * @return Boolean126 */ 127 functionFile_exists_case ($filename) {}  - 129 /**  the * Import the required class library with Java Import This function has the cache function131 * @param string $class Class library namespace strings the * @param string $baseUrl start path133 * @param string $ext imported file name extensions134 * @return Boolean135 */ 136 functionImport$class,$BASEURL= '',$ext=EXT) {} 137 138 /** 139 * Import function library based on namespace method $ * Load (' @. Util.array ')141 * @param string $name function library namespace string142 * @param string $baseUrl start path143 * @param string $ext imported file name extensions144 * @return void145 */ 146 functionLoad$name,$BASEURL='',$ext= '. php ') {} 147 148 /** 149 * Fast import of third-party framework class library all third-party framework class library files are placed under the vendor directory of the system. Max * @param string $class class library151 * @param string $baseUrl Base directory the * @param string $ext class library suffix153 * @return Boolean154 */ 155 functionVendor$class,$BASEURL= '',$ext= '. php ') {} 156 157 /** 158 * The D function is used to instantiate the model class format [resource://][module/] Model159 * @param string $name resource address the * @param string $layer model layer name161 * @return Model162 */ 163 functionD$name='',$layer='') {} 164 165 /** 166 * The M function is used to instantiate a model without a modeling file167 * @param string $name model name supports specifying the underlying model such as Mongomodel:user168 * @param string $tablePrefix table prefix169 * @param mixed $connection database connection information the * @return Model171 */ 172 functionM$name='',$tablePrefix='',$connection='') {} 173 174 /** 175 * Parse the resource address and import the class library file176 * For example Module/controller addon://module/behavior177 * @param string $name resource address format: [Extension://][module/] Resource name178 * @param string $layer hierarchical name179 * @return String the */ 181 functionParse_res_name ($name,$layer,$level=1) {} 182 183 /** 184 * A function is used to instantiate the controller format: [Resource://][module/] Controller185 * @param string $name resource address186 * @param string $layer control layer name187 * @param integer $level controller hierarchy188 * @return Controller|false189 */  the functionA$name,$layer='',$level='') {} 191 192 /** 193 * Operation method of Remote Call Controller URL parameter format [resource://][module/] Controller/Operation194 * @param string $url call address195 * @param string|array $vars Call parameters support strings and Arrays196 * @param string $layer The name of the control layer to invoke197 * @return Mixed198 */ 199 functionR$url,$vars=Array(),$layer='') {}  $ 201 /** 202 * Perform an action203 * @param string $name behavior name204 * @param Mixed $params parameters passed in205 * @return void206 */ 207 functionB$name, &$params=NULL) {} 208 209 /**  About * Remove whitespace and comments from the code211 * @param string $content code content212 * @return String213 */ 214 functionStrip_whitespace ($content) {} 215 216 /** 217 * Browser-friendly variable output218 * @param mixed $var variables219 * @param boolean $echo whether the output defaults to True if False returns the output string - * @param string $label tag is empty by default221 * @param boolean $strict is strict by default true222 * @return void|string223 */ 224 functionDump$var,$echo=true,$label=NULL,$strict=true) {} 225 226 /** 227 * URL Redirection228 * @param string $url The URL address of the redirect229 * Wait time for @param integer $time redirect (seconds) the * @param string $msg prompt before redirection231 * @return void232 */ 233 functionredirect$url,$time=0,$msg='') {} 234 235 /** 236 * Cache Management237 * @param mixed $name cache name if the array represents cache settings238 * @param mixed $value cache value239 * @param mixed $options cache parameters - * @return Mixed241 */ 242 functionS$name,$value='',$options=NULL) {} 243 244 /** 245 * Fast file data reading and saving for simple type data strings, arrays246 * @param string $name cache name247 * @param mixed $value cache value248 * @param string $path cache path249 * @return Mixed - */ 251 functionF$name,$value='',$path=Data_path) {} 252 253 /** 254 * Generate unique identification numbers based on PHP various types of variables255 * @param mixed $mix variables the * @return String257 */ 258 functionTo_guid_string ($mix) {} 259 260 /** 261 * XML Encoding262 * @param mixed $data data263 * @param string $root root node name the * @param a sub-node name for a string $item numeric index265 * @param string $attr root node properties266 * @param string $id Numeric index child node key conversion property name267 * @param string $encoding data encoding268 * @return String269 */  the functionXml_encode ($data,$root= ' Think ',$item= ' Item ',$attr='',$id= ' id ',$encoding= ' Utf-8 ') {} 271 272 /** 273 * Data XML encoding274 * @param mixed $data data275 * Node name when @param string $item a numeric index276 * @param string $id Numeric index key to the property name277 * @return String278 */ 279 functionData_to_xml ($data,$item= ' Item ',$id= ' id ') {} 280 281 /** 282 * Session management function283 * @param string|array $name Session name if the array represents the session setting284 * @param mixed $value Session value285 * @return Mixed286 */ 287 functionSession$name,$value='') {} 288 /** 289 * Cookie settings, access, deletion290 * @param string $name cookie name291 * @param mixed $value cookie value292 * @param mixed $options cookie Parameters293 * @return Mixed294 */ 295 functionCookies ($name,$value='',$option=NULL) {} 296 297 /** 298 * Load dynamic Extension Files299 * @return void - */ 301 functionLoad_ext_file ($path) {} 302 /** 303 * Get client IP address304 * @param integer $type return type 0 return IP address 1 return IPV4 address number305 * @return Mixed306 */ 307 functionGET_CLIENT_IP ($type= 0) {} 308 309 /** 310 * Send HTTP status311 * @param integer $code status code312 * @return void313 */ 314 functionSend_http_status ($code) {} 315  the //filter expressions in a form 317 functionFilter_exp (&$value) {} 318 319 //Case -insensitive In_array implementations  the functionIn_array_case ($value,$array) {}

The above describes the thinkphp built-in functions in detail D, F, S, C, L, A, I, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.