![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Yii2
强哥83
啦啦啦
展开
-
Yii2 ListView显示数据
控制器<?phpnamespace app\controllers;use yii\web\Controller;use yii\data\Pagination;use yii\data\ActiveDataProvider;use app\models\ZsDynasty;class TestController extends Controller{ publi原创 2015-03-06 14:55:18 · 8965 阅读 · 0 评论 -
Yii2 bootstrap 内置组件
ActiveField ActiveFormAlertBootstrapAssetBootstrapPluginAssetBootstrapThemeAssetButtonButtonDropdownButtonGroupCarousel //水平图片滚动Collapse //百叶窗Dropdown //下拉lableModal //模式弹层Na翻译 2015-03-13 20:50:57 · 6943 阅读 · 0 评论 -
加载自定义类库
index.phprequire(__DIR__ . '/../vendor/autoload.php');require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');Yii::$classMap['LibImage'] = __DIR__ . '/../libs/LibImage.php';$config = require(__DIR_原创 2015-03-14 10:52:12 · 1297 阅读 · 0 评论 -
Yii2 自定义组件
basic\components\HelloWidget.php<?phpnamespace app\components;use yii\base\Widget;use yii\helpers\Html;class HelloWidget extends Widget{ public $message; public function init() {翻译 2015-03-13 20:31:45 · 5010 阅读 · 0 评论 -
Yii2 表单
结构namespace app\models\test;use yii\db\ActiveRecord;class Dynasty extends ActiveRecord //或者 \yii\base\Model{ public $username; public $password;}namespace app原创 2015-03-13 19:25:57 · 6612 阅读 · 1 评论 -
Yii2 缓存
参考:http://www.yiiframework.com/doc-2.0/guide-caching-overview.html配置'components' => [ 'cache' => [ 'class' => 'yii\caching\FileCache', ],数据缓存$cache = \Yii::$app->cache;原创 2015-03-07 17:50:41 · 7561 阅读 · 0 评论 -
Yii2 数据库Active Record(ORM)
ACTIVE RECORD(ORM)参考:http://www.yiiframework.com/doc-2.0/guide-db-active-record.htmlnamespace app\models;use yii\db\ActiveRecord;class Customer extends ActiveRecord{ const STATUS_ACTIVE = 'act翻译 2015-03-07 17:04:42 · 18735 阅读 · 0 评论 -
Yii2 调用数据简单显示
数据模型层models/ZsDynasty.php<?phpnamespace app\models;use yii\db\ActiveRecord;class ZsDynasty extends ActiveRecord{}ZsDynasty 对应数据库表 zs_dynasty控制器Controller/TestController.php<?php原创 2015-03-06 14:50:07 · 13510 阅读 · 0 评论 -
Yii2 网址重写
参考:http://www.yiiframework.com/doc-2.0/guide-helper-url.htmlhttp://www.yiiframework.com/doc/guide/1.1/zh_cn/topics.url.htaccess Options +FollowSymLinks IndexIgnore */* RewriteE原创 2015-03-06 14:34:14 · 4197 阅读 · 0 评论 -
Yii2 数据操作Query Builder
Query Builder$rows = (new \yii\db\Query()) ->select(['dyn_id', 'dyn_name']) ->from('zs_dynasty') ->where(['between','dyn_id', 1,30]) ->limit(10) ->all();print_r($rows);use yii\db\Query;$que原创 2015-03-07 15:59:42 · 60732 阅读 · 0 评论 -
Yii2 布局模板
public function actionIndex(){ $this->layout='@app/views/layouts/main2.php'; return $this->render('index');}参考:http://www.tuicool.com/articles/BrY7Vf7转载 2015-03-14 11:52:02 · 1315 阅读 · 0 评论