Yii框架中使用bootstrap

Yii是类似于ROR的一个快速开发框架,PHP编写,用起来比较顺手,bootstrap是一个css,js框架,可以用来快速建站,将两者结合在一起,

可以弥补美工的不足。下面是在Yii框架中使用bootstrap的简单步骤:

1.创建一个web项目并配置:

cmd中,定位到xampp下的php目录,并执行下面的语句:

E:\xampp\php>php e:\xampp\apache\htdocs\framework\yiic webapp e:\xampp\apache\ht

docs\TestBootstrap

 

这样就会创建一个名为TestBootstrap的项目

 

BootStrap for YiiExtension拷贝到TestBootstrapprotected\extensions目录下。

 

修改config目录下的main.php文件,'preload'=>array('log','bootstrap')等配置,完成后如下:

// preloading 'log' component

'preload'=>array('log','bootstrap'),

 

// autoloading model and component classes

'import'=>array(

'application.models.*',

'application.components.*',

),

 

'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'),

'generatorPaths'=>array(

'bootstrap.gii', // since 0.9.1

),

 

),

 

// application components

'components'=>array(

'user'=>array(

// enable cookie-based authentication

'allowAutoLogin'=>true,

),

'bootstrap'=>array(

'class'=>'ext.bootstrap.components.Bootstrap',

), 

原文地址:https://www.cnblogs.com/dahuzizyd/p/2444466.html