Thinkphp entry 4-layout, cache, system variable (48), thinkphp48_PHP tutorial

Source: Internet
Author: User
Thinkphp entry 4-layout, cache, system variable (48), thinkphp48. Thinkphp entry 4-layout, cache, system variable (48), thinkphp48 [controller operation method parameter settings] URL index. php controller operation method [page jump] Thinkphp entry 4-layout, cache, system variable (48), thinkphp48
[Controller operation method parameter settings]

Http: // URL/index. php/controller/operation method

Page jump]

Variable regulator]

Smarty variable regulator

[Subtemplate inclusion]

The current module contains each other

[Use layout] 1. enable layout and configure variable information config. php

2. create the layout file Tpl/home/layout.html 3. do not use layout {__ NOLAYOUT __}

Layout Group

Home admin
A. Each group has its own configuration file config. php.
B. enable the layout function for each layout file
C. set the layout file for each group
Tp/home/layout.html
Tpl/admin/layout.html

Use custom layout

[Cache usage of tp framework]

Cache variable information (common variables, arrays, objects ),
Cache static html content, cache part or all

Most of our data is obtained from the mysql database.

Cache medium: Memory (memcache), files (solving the database), cache to the database

The data is optimized and stored in the database.

File cache of the tp framework (shortcut function ):
A) set S (name, value)
B) read S (name)
C) delete S (name, null)

1. you can set cache files to different directories for storage.

This prevents a directory from storing too many cached files, affecting performance.

2 Cache validity period

S (name, value, time );

3 Cache settings

4Cache usage:

5. cache deletion

6 cache use cases

System variables]

Use all variables $ _ GET $ _ POST $ _ SESSION $ _ COOKIE in the template.
Constant usage:
$ Think. const. constant name
$ Think. get. name

Get configuration variable information in the template config. php
$ Think. config. name

Get configuration variable information in the controller
C (name); // shortcut function


Original output literal label]

Layout 4-layout, cache, system variable (48), thinkphp48 [controller operation method parameter settings] http: // URL/index. php/controller/operation method [page jump ]...

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.