yii 阅读 2498
Yii2 第10章 view中使用controller定义的变量

Yii2 第10章 view中使用controller定义的变量

2022-06-27 • lulubin

一、从 controller 传递值到 view 中

https://file.lulublog.cn/images/3/2022/08/hTZzPO75ycEIIsaYAeCm9lS5ey9LCC.png?sign=60f7fd0f805fcd25ba53ff33e6d35cf6&t=6acfa700

https://file.lulublog.cn/images/3/2022/08/xcJNBEnCeAErx8L8rB8tXEIGZcT8ij.png?sign=a97d7edaa8272142f69683581c944e07&t=6acfa700

二、在 controller 设置 view::params 属性的值

在 view 中访问

https://file.lulublog.cn/images/3/2022/08/JvgGVC4NP7VppSsu7y4chG5YuGV97N.png?sign=132598eafce4e45c4741c3564e1798ca&t=6acfa700

三、view::context 获取上下文

https://file.lulublog.cn/images/3/2022/08/VWt2Y5ppsKZIoKpM27yB518wTTb2Dk.png?sign=72cd7b454807a45cd2b8383325a5800a&t=6acfa700

https://file.lulublog.cn/images/3/2022/08/YyIiLEZeMapZIlZy2eeeIaiEE2Qeaz.png?sign=70c17787e6774ffc3783d41c6b41715f&t=6acfa700

打赏

×

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开微信扫一扫,即可进行扫码打赏哦