Home  >  Article  >  Backend Development  >  PHP configures its own configuration file

PHP configures its own configuration file

WBOY
WBOYOriginal
2016-08-08 09:20:27973browse

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 => '只使用套餐卡'
	    )
   	);
?>

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'];

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:
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
Previous article:phpini loading locationNext article:phpini loading location