


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!
1. Create a new test.php configuration file under thinkphp\config\
2.test.php
<?php // 自定义配置文件 return [ 'profile' => [ 'name' => 'mmcike', 'bank' => [ 'ABC' => '123', 'ncaa' ] ] ];
3. Call the test.php configuration file
// 1.调用整个数组 $testConfig = \think\facade\Config::get('test'); //注意 //test.php 就是配置文件名称
Output:
// 2.只调用键名 profile 下的数组 $profile = \think\facade\Config::get('test.profile');
输出:
// 3.调用索引键的数组 $val = \think\facade\Config::get('test.profile.bank.0');
输出:
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!

This article compares Lenovo's ThinkBook and ThinkPad laptop lines. ThinkPads prioritize durability and performance for professionals, while ThinkBooks offer a stylish, affordable option for everyday use. The key differences lie in build quality, p

This article explains how to prevent SQL injection in ThinkPHP applications. It emphasizes using parameterized queries via ThinkPHP's query builder, avoiding direct SQL concatenation, and implementing robust input validation & sanitization. Ad

This tutorial addresses common ThinkPHP vulnerabilities. It emphasizes regular updates, security scanners (RIPS, SonarQube, Snyk), manual code review, and penetration testing for identification and remediation. Preventative measures include secure

This article addresses ThinkPHP vulnerabilities, emphasizing patching, prevention, and monitoring. It details handling specific vulnerabilities via updates, security patches, and code remediation. Proactive measures like secure configuration, input

This article details ThinkPHP software installation, covering steps like downloading, extraction, database configuration, and permission verification. It addresses system requirements (PHP version, web server, database, extensions), common installat

This article demonstrates building command-line applications (CLIs) using ThinkPHP's CLI capabilities. It emphasizes best practices like modular design, dependency injection, and robust error handling, while highlighting common pitfalls such as insu

This guide details database connection in ThinkPHP, focusing on configuration via database.php. It uses PDO and allows for ORM or direct SQL interaction. The guide covers troubleshooting common connection errors, managing multiple connections, en

This article introduces ThinkPHP, a free, open-source PHP framework. It details ThinkPHP's MVC architecture, features (routing, database interaction), advantages (rapid development, ease of use), and disadvantages (potential over-engineering, commun


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

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

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
