Home >Backend Development >PHP Tutorial >Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 09:51:07824browse

Getting Started with Thinkphp 4 - Layout, Cache, System Variables (48), thinkphp48

[Controller Operation Method Parameter Settings]

http://website/index.php/controller/operation method

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial[Page jump]

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial【Variable Regulator】

Smarty variable regulator

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial[Subtemplate contains]

Current modules contain each other

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial【Use layout】

 1. Open the layout and configure variable information config.php

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial 2. Create layout file Tpl/home/layout.html

 3. Do not use layout {__NOLAYOUT__}

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP TutorialLayout Grouping

home admin
  a. Each group has its own configuration file config.php
b. Set the layout enable function for each layout file
c. Set the layout file for each group
Tp /home/layout.html
Tpl/admin/layout.html

Use custom layout

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial[tp framework cache usage]

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

Most of our data is obtained from the mysql database.

Cache media: memory (memcache), file (processing database), cache to database

The data is stored in the database after optimization.

Tp framework’s file cache (shortcut function):
a) Set S (name, value)
b) Read S (name)
c) Delete S (name, null)

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial 1 You can set cache files to different directories to store

This can avoid storing too many cache files in one directory and affecting performance

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial 2 Cache validity period

S(name, value, time);

 3 Cache settings

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial 4 Cache usage:

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial 5 Cache deletion

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial 6 Caching use cases

Getting Started with Thinkphp 4—Layout, Cache, System Variables (48), thinkphp48_PHP Tutorial【System Variables】

Use all variables in the template $_GET $_POST $_SESSION $_COOKIE, etc.
Constant usage:
$Think.const.Constant name
$Think.get.Name

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

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


[Output literal tags as they are]

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1014827.htmlTechArticleThinkphp Getting Started 4 - Layout, Cache, System Variables (48), thinkphp48 [Controller operation method parameter setting] http ://Website/index.php/Controller/Operation method [Page jump]...

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn