Table of Contents
The above contains the calling forms of most arrays.
Home PHP Framework ThinkPHP Thinkphp6 custom configuration file and call (configuration under the config folder)

Thinkphp6 custom configuration file and call (configuration under the config folder)

Mar 26, 2021 pm 05:36 PM
tp6

The following tutorial column of thinkphp will introduce to you the Thinkphp6 custom configuration file and the method of calling (configuration under the config folder). I hope it will be useful to friends who need it. help!

Thinkphp6 custom configuration file and call (configuration under the config folder)

1. Create a new test.php configuration file under thinkphp\config\

2.test.php

<?php
// 自定义配置文件
return [
    &#39;profile&#39; => [
        &#39;name&#39; => &#39;mmcike&#39;,
        &#39;bank&#39; => [
            &#39;ABC&#39; => &#39;123&#39;,
            &#39;ncaa&#39;
        ]
    ]
];
Copy after login

3. Call the test.php configuration file

// 1.调用整个数组
$testConfig = \think\facade\Config::get(&#39;test&#39;);

//注意
//test.php 就是配置文件名称
Copy after login

Output:

// 2.只调用键名 profile 下的数组
$profile = \think\facade\Config::get(&#39;test.profile&#39;);
Copy after login
输出:
Copy after login
Copy after login

// 3.调用索引键的数组
$val = \think\facade\Config::get(&#39;test.profile.bank.0&#39;);
Copy after login
输出:
Copy after login
Copy after login

The above contains the calling forms of most arrays.

Related recommendations: The latest 10 thinkphp video tutorials

The above is the detailed content of Thinkphp6 custom configuration file and call (configuration under the config folder). For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)