这篇文章主要介绍了ThinkPHP公共配置文件与各自项目中配置文件组合的方法,涉及array_merge函数将多个数组合并的方法,是ThinkPHP项目开发中非常实用的技巧,需要的
本文实例讲述了ThinkPHP公共配置文件与各自项目中配置文件组合的方法。分享给大家供大家参考。具体实现方法如下:
在使用ThinkPHP时,在布局目录时,常使用的是单个入口文件对应一个项目目录,但是这样在写配置文件时,在各自的配置文件中,经常会使用重复的配置项,所用这时就会将公共的配置项放在一个公共的目录下。
具体实现方法:
使用配置文件的特性return array();可以在各自项目中的配置文件中这样定义:
复制代码 代码如下:
$config = array(''=>'',);
然后使用函数复制代码 代码如下:
return array_merge(include'./conf/config.php',$config);
这样就可以在最根目录下面使用公共的配置文件
希望本文所述对大家的ThinkPHP框架程序设计有所帮助。
,
Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools

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),