Author: Bailang Source: http://www.manks.top/article/yii2_gridview_visible
The copyright of this article belongs to the author. Reprinting is welcome, but this statement must be retained without the author's consent, and the original text must be given in a prominent position on the article page connection, otherwise we reserve the right to pursue legal liability.
Let’s take a simple case
Condition: There is a get parameter type
Requirement: Only when the value of type is equal to 1, the column name will be displayed, otherwise the column will not be displayed
The code is implemented as follows:
<span>[ </span>'attribute' => 'name', 'value' => <span>$model</span>->name, 'visible' => <span>intval</span>(Yii::<span>$app</span>->request->get('type')) == 1,<span>]</span>,
The implementation method is also very simple.
The above introduces the case of whether yii2 gridview displays a certain column, including the content of GRIDVIEW. I hope it will be helpful to friends who are interested in PHP tutorials.