yii

一.
访问某个指定的文件
Index.php?r=控制器名/方法名
在这里插入图片描述
方法名必须要有action 文件名必须要有Controller

在这里插入图片描述

在这里插入图片描述

Yii框架中 form表单传值
在这里插入图片描述
无刷新操作删除
在这里插入图片描述在这里插入图片描述

上传图片组件需要修改
Yii2.0搜索file_upload
在这里插入图片描述
修改Uploader.php中的$randNum = rand(1,9999) . rand(1,999);

修改图片存储地址 和显示地址
在这里插入图片描述在这里插入图片描述

接受图片自己添加上文件名

Gii生成的 数据分页加改变样式
在这里插入图片描述
在自己的样式使用验证需要添加

<?php use backend\assets\AppAsset; use yii\helpers\Html; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use yii\widgets\Breadcrumbs; use common\widgets\Alert; ?> <?php $this->beginPage() ?> <?php $this->head() ?> <?php $this->beginBody() ?> <?php $this->endBody() ?> <?php $this->endPage() ?>

Yii上传文件

use yii\web\UploadedFile;
m o d e l &gt; f i l e = U p l o a d e d F i l e : : g e t I n s t a n c e ( model-&gt;file = UploadedFile::getInstance( model, ‘file’);
上传文件 if ($model->file) {
$model->file->saveAs(‘uploads/’ . $model->file->baseName . ‘.’ . $model->file->extension);

        }

Yiisql语句where查询条件
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_43632766/article/details/83827885
yii