search
Homephp教程php手册ThinkPHP中公共函数路径和配置项路径的映射分析

这篇文章主要介绍了ThinkPHP中公共函数路径和配置项路径的映射,较为通俗的分析了ThinkPHP中公共函数路径和配置项路径的映射关系与对应修改位置,有助于更好的理解

本文实例分析了ThinkPHP中公共函数路径和配置项路径的映射。分享给大家供大家参考。具体分析如下:

ThinkPHP中在使用公共函数时(单一入口文件对应独立的项目),在Common文件夹中可以写公共的函数文件,写成文件名为common.php的文件会被系统自动加载,如果写成其他的函数名,则不会自动加载,但是有两种处理机制

1、在使用的时候手动加载 load('@.function');这样就会手动加载这个文件。@代表是在这个项目下的Common文件夹下的。

2、在配置文件中配置

复制代码 代码如下:

'LOAD_EXT_FILE' => 'function'

在ThinkPHP中__PUBLICC__这个不是一个常量,而是一个映射,默认是在最根目录下的Public目录,,可以在配置文件中修改,

复制代码 代码如下:

'TMPL_PARSE_STRING' => __ROOT__.'Public'

希望本文所述对大家的ThinkPHP框架程序设计有所帮助。

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools