basic\components\HelloWidget
namespace app\components;
use yii\base\Widget;
use yii\helpers\Html; class HelloWidget extends Widget
{
public $message; public function init()
{
parent::init();
if ($this->message === null) {
$this->message = '您好';
}
} public function run()
{
return Html::encode($this->message);
}

  

View

[php] view plaincopy在CODE上查看代码片派生到我的代码片
<?php
use app\components\HelloWidget;
?>
<?= HelloWidget::widget(['message' => '组件']) ?>

  

最新文章

  1. hibernate延迟加载
  2. 《转载》Spring MVC之@RequestBody, @ResponseBody 详解
  3. &lt;十二&gt;JDBC_批量处理
  4. android ContentObserver
  5. Unity使用protobuf-net进行二进制序列化与反序列化
  6. LINQ日常使用记录
  7. 搭建WebRtc环境
  8. map reduce filter
  9. &lt;marquee&gt;属性详解
  10. 读懂diff
  11. 多项分布(multinominal distribution)
  12. ORA-15025: could not open disk 处理
  13. MyBatis的分页操作(MySQL)
  14. CAS单点登录(SSO)完整教程
  15. YII 小部件实现的注册表
  16. 【枚举+小技巧】【TOJ4115】【Find the number】
  17. Windows环境搭建与第一个C# Sample
  18. python全栈学习--day10(函数进阶)
  19. spring-boot集成activiti的model遇到问题汇总
  20. mysql用户管理和pymysql模块

热门文章

  1. The user specified as a definer (&#39;root&#39;@&#39;%&#39;) does not exist解决
  2. Spring 讲解(五)
  3. Ubuntu更新完NVIDIA驱动后,重启电脑进入不了系统,一直处于登录界面
  4. 四轴遥控器ADC部分
  5. POJ 1655 Balancing Act (树状dp入门)
  6. POJ 3187 Backward Digit Sums (dfs,杨辉三角形性质)
  7. sql中简单的触发器功能
  8. [CSP-S模拟测试]:简单的玄学(数学)
  9. tcp和udp得区别
  10. kafka ProducerConfig 配置