Yii2 自定义组件
2015-08-27 22:51
666 查看
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' => '组件']) ?>
相关文章推荐
- ubuntu下使用phpstorm开发php程序
- php+mysql留言板(模仿qq空间留言板)
- PHP分页算法
- Yii2增、删、改、查
- Yii2中一些常用的参数
- STM32 Timer : Base Timer, Input Capture, PWM, Output Compare
- setAttribute和setParameter方法的区别
- php模式设计之 工厂模式
- php设计模式专题附源码(解释器模式、工厂方法模式、外观模式、装饰模式、建造者模式)
- tftp协议的实现
- 配置FTP服务
- phpmyadmin 尝试连接到 mysql 服务器被拒绝
- php fpm start.sh
- EditPlus+VisualStudio配置VC简易开发环境环境
- php大力力 [028节] 如何下载js文件,网上一个*.js无法下载啊??????
- php 内存不足而,报错
- php安装完后配置php.ini和php-fpm.conf
- mac 下 sphinx + mysql + php 实现全文搜索(xampp)(4)php api 解析
- PHP中isset、empty、is_null实验测试
- Erlang:请求php数据,GET、POST