Yii学习(2)----主配置文件

<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',//当前应用根目录的绝对物理路径
	'name'=>'Ge Yii Test Study!',//当前应用的名称

	// preloading 'log' component
	'preload'=>array('log'),//与载入log(记录)组件,无论什么情况都会被创建

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',//载入application/models/文件夹下的所有模型类
		'application.components.*',//载入application/components/文件夹下的所有应用组件类
	),

	'defaultController'=>'site',//设置默认控制器类
	
	'modules'=>array(
		// uncomment the following to enable the Gii tool
		/*
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'Enter Your Password Here',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
		*/
	),

	// application components
	//当前应用的组件配置。更多可供配置的组件详见下面的"核心应用组件"
	'components'=>array(
		'user'=>array(//用户组件配置,user为组件ID
			// enable cookie-based authentication(可基于cookie的认证)			
			'allowAutoLogin'=>true,
		),
		
		'cache'=>array( //缓存组件
			'class'=>'CMemCache', //缓存组件类
			'servers'=>array( //MemCache 缓存服务器配置
							array('host'=>'server1', 'port'=>11211, 'weight'=>60), //缓存服务器1
							array('host'=>'server2', 'port'=>11211, 'weight'=>40), //缓存服务器2
			),
		),		
		
		// uncomment the following to enable URLs in path-format
		/*
		'urlManager'=>array(//URL路由管理器
			'urlFormat'=>'path',
			//共支持两种格式: 'path' 格式( 如:/path/to/EntryScript.php/name1/value1/name2/value2... ) 和'get' 格式( //如:/path/to/EntryScript.php?name1=value1&name2=value2...)。当使用'path'格式时,需要设置如下的规则:
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			),
		),
		*/
		'db'=>array(
			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
		),
		// uncomment the following to use a MySQL database
		/*
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=testdrive',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => '',
			'charset' => 'utf8',
			'tablePrefix =>'tbl_',
		),
		*/
		'errorHandler'=>array(
			// use 'site/error' action to display errors
			// 使用SiteController 控制器类中的actionError 方法显示错误
			'errorAction'=>'site/error',
		),
		'log'=>array(//处理记录信息的类
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',//处理错误信息的类
					'levels'=>'error, warning',//错误等级
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',//将错误记录消息在网页上显示
				),
				*/
			),
		),
	),//应用组件配置结束

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	//使用Yii::app()->params['参数名']可以访问应用层的参数
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'webmaster@example.com',
	),
);

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值