Home Backend Development PHP Tutorial PHP configures its own configuration file

PHP configures its own configuration file

Aug 08, 2016 am 09:20 AM
array config gt order type

Example:

The first step is to create an order.php file in the application/config/ directory.

Add the following code:

<?php
	$config['order'] = array(
		'os_type' => array(
	        "0"=>"Android 客户端",
	        "1"=>"iOS 客户端",
	        "3"=>"微信公共帐号",
	        "4"=>"360",
	        "5"=>"网页版",
	        "6"=>"神马搜索",
	        "10"=>"大众点评",
	        "11"=>"美团"
	    ),
    	'pay_type' => array(
	        1 => '微信',
	        2 => '支付宝',
	        3 => '微信公众',
	        4 => '免费',
	        5 => '只使用套餐卡'
	    )
   	);
?>
Copy after login

Step 2: Get the configuration file

       $this->config->load('order',TRUE);
       $order_config = $this->config->item('order', 'order');
       $os_type = $order_config['os_type'];
       $pay_type_list = $order_config['pay_type'];
Copy after login

The above introduces how to configure PHP to configure its own configuration file, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

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 Article Tags

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)

What are the differences between Huawei GT3 Pro and GT4? What are the differences between Huawei GT3 Pro and GT4? Dec 29, 2023 pm 02:27 PM

What are the differences between Huawei GT3 Pro and GT4?

How to fix error 0xC00CE556 returned by the .NET parser How to fix error 0xC00CE556 returned by the .NET parser Apr 25, 2023 am 08:34 AM

How to fix error 0xC00CE556 returned by the .NET parser

Fix: Snipping tool not working in Windows 11 Fix: Snipping tool not working in Windows 11 Aug 24, 2023 am 09:48 AM

Fix: Snipping tool not working in Windows 11

What are the uses of the Type keyword in Go? What are the uses of the Type keyword in Go? Sep 06, 2023 am 09:58 AM

What are the uses of the Type keyword in Go?

Solve Ubuntu mounting mobile hard disk error: unknown file system type exfat Solve Ubuntu mounting mobile hard disk error: unknown file system type exfat Jan 05, 2024 pm 01:18 PM

Solve Ubuntu mounting mobile hard disk error: unknown file system type exfat

How to Fix Can't Connect to App Store Error on iPhone How to Fix Can't Connect to App Store Error on iPhone Jul 29, 2023 am 08:22 AM

How to Fix Can't Connect to App Store Error on iPhone

Sort array using Array.Sort function in C# Sort array using Array.Sort function in C# Nov 18, 2023 am 10:37 AM

Sort array using Array.Sort function in C#

How to use ThinkPHP\Config for configuration management in php? How to use ThinkPHP\Config for configuration management in php? May 31, 2023 pm 02:31 PM

How to use ThinkPHP\Config for configuration management in php?

See all articles