This article mainly introduces the usage of the Yii configuration file and analyzes in detail the configuration techniques of controllers, project names, pathinfo, logs, and so on in the project development in the form of instances, which is of great practical value, for more information about Yii configuration files, see the following section. Share it with you for your reference. The specific analysis is as follows:
The Yii configuration file is much more complicated than ThinkPHP. first, record the configurations you know. if you are interested, refer:
The code is as follows:
<? Php
// Master configuration file
$ Config = array (
'Modules' => array (
'Giii '=> array (
'Class' => 'system. gii. GiiModule ',
'Password' => 'admin ',
),
),
'Basepath' => dirname (_ FILE _). DIRECTORY_SEPARATOR .'..',
'Name' => 'yii learn', // project name
'Preload' => array ('log '),
'Import' => array (// automatically loaded class
'Application. models .*',
'Application. components .*',
),
'Defaultcontroller' => 'index', // Default controller
'Layout '=> 'layout', // layout file
'Components' => array (
'DB' => array (// database configuration
'Connectionstring' => 'MySQL: host = localhost; dbname = h. me ',
'Username' => 'root ',
'Password' => '',
'Charset' => 'utf8 ',
'Tableprefix' => 'TP _',
'Enablesparamlogging' => true, // displays SQL statements with parameters
),
'Urlmanager' => array (
'Urlformat' => 'path', // pathinfo mode
'Showscriptname' => false, // set false to hide index. php.
// 'Urlsuffix '=> '.html', // The url suffix is equivalent to pseudo static
),
'Errorhandler' => array (
'Erroraction' => 'index/error', // method for redirecting from error 404
),
'Log' => array (// log
'Class' => 'clogrouter ',
'Routes '=> array (
Array (
'Class' => 'cweblogroute ',
'Levels' => 'Trace, error, waring ', // Application Log display level
'Category' => 'system. * ', // record category
),
),
),
),
'Params' => require (dirname (_ FILE _). '/params. php '),
);
Return $ config;
?>
I hope this article will help you design PHP programs based on the Yii Framework.