ThinkPHP3.1.3 single-Letter function summary

Source: Internet
Author: User
Tags vars

Http://www.thinkphp.cn/topic/9688.html

a function : used to instantiate the action format: [Project://][Group/] Module

  1. /**
  2. * A function is used to instantiate the action format: [item://][Group/] Module
  3. * @param string $name Action resource address
  4. * @param string $layer control layer Name
  5. * @param Boolean $common whether the public directory
  6. * @return Action|false
  7. */

  8. A($name,$layer=",$common=false)
Copy Code

b function : Perform a behavior

    1. /**
    2. * Perform an action
    3. * @param string $name behavior name
    4. * @param Mixed $params parameters passed in
    5. * @return void
    6. */

    7. B($name, &$params=NULL)
Copy Code

C function : Get and Set configuration parameters support Batch Definition

    1. /**
    2. * Get and Set configuration parameters support Batch Definition
    3. * @param string|array $name Configuration variables
    4. * @param mixed $value configuration values
    5. * @return Mixed
    6. */

    7. C($name=null, $value=null)
Copy Code

d function : used to instantiate the model format item://Group/module

    1. /**
    2. * The D function is used to instantiate the model format item://Group/module
    3. * @param string $name model resource Address
    4. * @param string $layer business layer Name
    5. * @return Model
    6. */

    7. D($name=",$layer=")
Copy Code

f function : Fast file data read and save for simple type data strings, arrays

  1. /**
  2. * Fast file data reading and saving for simple type data strings, arrays
  3. * @param string $name cache name
  4. * @param mixed $value Cache value
  5. * @param string $path cache path
  6. * @return Mixed
  7. */

  8. F($name, $value=", $path=data_path)
Copy Code

g functions : Recording and statistical time (microseconds) and memory usage

  1. /**
  2. * Recording and statistical time (microseconds) and memory usage
  3. * How to use:
  4. * <code>
  5. * G (' begin '); Record start tag bit
  6. * // ... Interval Run code
  7. * G (' end '); Record end tag Bit
  8. * Echo G (' Begin ', ' End ', 6); Statistics interval run time is accurate to 6 digits after decimal
  9. * Echo G (' Begin ', ' End ', ' m '); Statistical interval Memory Usage
  10. * If the end tag bit is not defined, it will be automatically marked as the current marker bit
  11. * Where statistics memory usage requires MEMORY_LIMIT_ON constant is true only valid
  12. * </code>
  13. * @param string $start start tag
  14. * @param string $end end tag
  15. * @param integer|string $dec decimal digits or M
  16. * @return Mixed
  17. */

  18. G($start,$end=",$dec=4)
Copy Code

I function : Get input parameters support filtering and default values

  1. /**
  2. * Get input parameters to support filtering and default values
  3. * How to use:
  4. * <code>
  5. * I (' id ', 0); Get ID parameter automatically determine get or post
  6. * I (' post.name ', ' ', ' htmlspecialchars '); Get $_post[' name ']
  7. * I (' get. '); Get $_get
  8. * </code>
  9. * @param string $name The name of the variable supports the specified type
  10. * @param the default value when the mixed $default does not exist
  11. * @param mixed $filter parameter filtering method
  12. * @return Mixed
  13. */

  14. I($name,$default=",$filter=null)
Copy Code

l functions : Get and set language definitions (case insensitive)

    1. /**
    2. * Get and set language definitions (case insensitive)
    3. * @param string|array $name language variables
    4. * @param string $value language value
    5. * @return Mixed
    6. */

    7. L($name=null, $value=null)
Copy Code

m function : Used to instantiate a model without a modeling file

  1. /**
  2. * The M function is used to instantiate a model without a modeling file
  3. * @param string $NAME model name supports specifying the underlying model such as Mongomodel:user
  4. * @param string $tablePrefix table prefix
  5. * @param mixed $connection database connection information
  6. * @return Model
  7. */

  8. M($name=", $tablePrefix=",$connection=")
Copy Code

n functions : Set up and get statistical data

  1. /**
  2. * Set up and get statistical data
  3. * How to use:
  4. * <code>
  5. * N (' db ', 1); Number of database operations logged
  6. * N (' read ', 1); Record number of reads
  7. * Echo N (' db '); Get all operations for the current page database
  8. * Echo N (' read '); Gets the current page read count
  9. * </code>
  10. * @param string $key identify the location
  11. * @param integer $step step value
  12. * @return Mixed
  13. */

  14. N($key, $step=0,$save=false)
Copy Code

r functions : How to invoke modules remotely URL parameter format [project://][Group/] Module/operation

  1. /**
  2. * Operation method of Remote Call module URL parameter format [project://][Group/] Module/operation
  3. * @param string $url call Address
  4. * @param string|array $vars Call parameters support strings and arrays
  5. * @param string $layer The name of the control layer to invoke
  6. * @return Mixed
  7. */

  8. R($url,$vars=array(),$layer=")
Copy Code

s function : Cache management

  1. /**
  2. * Cache Management
  3. * @param mixed $name cache name if the array represents cache settings
  4. * @param mixed $value Cache value
  5. * @param mixed $options cache parameters
  6. * @return Mixed
  7. */

  8. S($name,$value=",$options=null)
Copy Code

t function : Get template file Format item://Group @ theme/module/operation

    1. /**
    2. * Get template file Format item://Group @ theme/module/operation
    3. * @param string $name template resource Address
    4. * @param string $layer view layer (directory) name
    5. * @return String
    6. */

    7. T($template=",$layer=")
Copy Code

u function : URL assembly supports different URL patterns

  1. /**
  2. * URL assembly supports different URL patterns
  3. * @param string $url URL expression, format: ' [group/module/Operation # Anchor @ domain name]? parameter 1= value 1& parameter 2= value 2 ... '
  4. * @param string|array $vars parameters passed in, supports arrays and strings
  5. * @param string $suffix pseudo-static suffix, which by default is true to get the configuration value
  6. * @param boolean $redirect whether to jump, if set to true to jump to the URL address
  7. * @param boolean $domain whether the domain name is displayed
  8. * @return String
  9. */

  10. U($url=',$vars=',$suffix=true,$redirect= false,$domain=false)
Copy Code

W function : Render Output Widget

  1. /**
  2. * Render Output Widget
  3. * @param string $name widget name
  4. * @param array $data parameters passed in
  5. * @param boolean $return whether to return content
  6. * @param string $path widget path
  7. * @return void
  8. */

  9. W($name, $data=array(), $return=false,$path=" )
Copy Code

method of Use helicopter : http://www.thinkphp.cn/document/309.html

ThinkPHP3.1.3 single-Letter function summary

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.