服务器之家

服务器之家 > 正文

Yii框架函数简单用法分析

时间:2021-08-17 15:39     来源/作者:阿朗999

本文实例讲述了Yii框架函数简单用法。分享给大家供大家参考,具体如下:

1.redict

?
1
return $this->redirect(['login']);

redict其实是对于以下的封装  等同于

?
1
2
$response=Yii::app->response();
$response->headers->add('location','www.baidu.com');

2.save

第一个参数是执行验证,第二个参数是指的那个字段(空的话 就保存全部)

如果是一个两个的话  必须知名属性

?
1
2
3
4
5
6
7
8
* @param bool $runValidation whether to perform validation (calling [[validate()]])
 * before saving the record. Defaults to `true`. If the validation fails, the record
 * will not be saved to the database and this method will return `false`.
 * @param array $attributeNames list of attribute names that need to be saved. Defaults to null,
 * meaning all attributes that are loaded from DB will be saved.
 * @return bool whether the saving succeeded (i.e. no validation errors occurred).
 */
public function save($runValidation = true, $attributeNames = null)

3.Yii前面加一个\代表的全局

4.as

一个类文件中重复可以使用as 起一个别名

5.设置布局文件

Yii框架函数简单用法分析

6.classname

Yii框架函数简单用法分析

order::classname---表示的order的AR类的所有的属性

希望本文所述对大家基于Yii框架的PHP程序设计有所帮助。

原文链接:https://blog.csdn.net/fujian9544/article/details/88051275

标签:

相关文章

热门资讯

2022年最旺的微信头像大全 微信头像2022年最新版图片
2022年最旺的微信头像大全 微信头像2022年最新版图片 2022-01-10
蜘蛛侠3英雄无归3正片免费播放 蜘蛛侠3在线观看免费高清完整
蜘蛛侠3英雄无归3正片免费播放 蜘蛛侠3在线观看免费高清完整 2021-08-24
背刺什么意思 网络词语背刺是什么梗
背刺什么意思 网络词语背刺是什么梗 2020-05-22
yue是什么意思 网络流行语yue了是什么梗
yue是什么意思 网络流行语yue了是什么梗 2020-10-11
暖暖日本高清免费中文 暖暖在线观看免费完整版韩国
暖暖日本高清免费中文 暖暖在线观看免费完整版韩国 2021-05-08
返回顶部