Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在YII应用程序中更改CSS文件不会';行不通_Php_Css_Yii - Fatal编程技术网

Php 在YII应用程序中更改CSS文件不会';行不通

Php 在YII应用程序中更改CSS文件不会';行不通,php,css,yii,Php,Css,Yii,我正在尝试更改gridview,tableview,&detailview的样式。我发现应该将config/main.php文件更改为: ... // application components 'components'=>array( 'user'=>array( // enable cookie-based authentication 'allowAutoLogin'=>true, ), 'bootstrap'=&

我正在尝试更改
gridview
tableview
,&
detailview
的样式。我发现应该将
config/main.php
文件更改为:

...
// application components
'components'=>array(
    'user'=>array(
        // enable cookie-based authentication
        'allowAutoLogin'=>true,
    ),
    'bootstrap'=>array(
        'class'=>'bootstrap.components.Bootstrap',
    ),
     'widgetFactory'=>array(
        'widgets'=>array(
            'CGridView'=>array(
                'cssFile' => Yii::app()->request->baseUrl.'/css/table_and_grid.css',
            ),

        ),
    ),
...

我已经删除了应用程序生成的资产文件夹,但这没有帮助。当我加载视图时,我可以看到css表正在加载到页面的标题中,但是没有任何样式工作。为什么?如何修复?

我没有看到任何关于更改主配置文件
(main.php)
CGridView
样式的内容,但是您可以使用以下参数自定义
CGridView
样式:

$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'SOME ID',
'dataProvider'=>$YOUR_DATA_PROVIDET,
'cssFile'=>'...',
'baseScriptUrl'=>'...',
'filterCssClass'=>'...',
'itemsCssClass'=>'...',
'pagerCssClass'=>'...',
'rowCssClass'=>'...',
'summaryCssClass'=>'...',
));
您可以自己更改
。 有关更多信息,您可以通过以下链接查看
CGridView
的官方文档:


自定义css文件加载的位置是什么?您能使用Web inspector检查浏览器对css规则的解释吗?@ragingprodigy它是第一个加载的浏览器之一。而且浏览器没有解释任何规则,这就是问题所在。我认为您不需要更改main.config来更改样式。如果需要更改样式,可以重写基类中的函数和属性。