yii2
来源:互联网 发布:搬砖小伟的淘宝店 编辑:程序博客网 时间:2024/05/18 02:27
public function actionSay($message = 'Hello') { return $this->render('say', ['message' => $message]); }
实际是say方法,渲染到say视图里面了。
http://hostname/index.php?r=site/say&message=Hello+World
路由 site/say 将被解析至 SiteController 控制器和其中的 say 操作。
读取 country 表的数据去common\model里面创建Country.php
<?phpnamespace app\models;use yii\db\ActiveRecord;class Country extends ActiveRecord{}
操作
use app\models\Country;// 获取 country 表的所有行并以 name 排序$countries = Country::find()->orderBy('name')->all();
例如index 转成 actionIndex, hello-world 转成 actionHelloWorld。
// 如下代码不会生效,只有session这要多次传值
$session[‘captcha’][‘number’] = 5;
$session[‘captcha’][‘lifetime’] = 3600;
public function filters(){ return array( 'postOnly+edit,create', array( 'filters.xxx.Filter-edit,create', 'unit'=>'second', ), );}
在xxxFilter文件下,当执行edit和create的post请求过滤器时才执行这个操作
session保存在哪,php.ini搜索“session.save_path”
———————我是分割线———————–
**
验证码
**,流程是:先前台验证,然后我后台验证,再生成随机四位数,然后通过sms传过去同时也写到了log里面带着键名,验证时我只需要把他拿出来就好了。
阅读全文
0 0
- YII2
- YII2
- Yii2
- yii2
- Yii2
- yii2- language
- session -yii2
- cache -yii2
- redis - yii2
- yii2 - controller
- yii2 Activeform
- yii2安装
- yii2 事务
- yii2使用
- yii2 csrf
- yii2 提速
- Yii2 缓存
- yii2 beforeSave
- Leetcode Day6 2. Add Two Numbers I & II
- 如何连接ftp服务器
- Leetcode刷题记录
- iOS关于APP转让
- Easyui validatebox自定义提示
- yii2
- 阿里云网站部署(三):子域名解析
- 云栖·虾米音乐节嘉宾阵容、歌单曝光!今年马云会唱什么歌?
- 编写代码时需要的知识
- 香甜的黄油解题报告
- Java-IO(二)——RandomAccessFile
- Oracle11g中OracleDBConsoleorcl服务无法启动
- MyEclipse WebSphere开发教程:安装和更新WebSphere 6.1, JAX-WS, EJB 3.0(三)
- Linux ALSA声卡驱动之一:ALSA架构简介