yii2缓存Cache

2022-03-25 20:36:10 浏览数 (1)

代码语言:javascript复制
<?php
namespace frontendcontrollers;
use Yii;
use frontendmodelsLoginForm;
class IndexController extends yiiwebController
{
	
	public function actionSite()
	{
	//设置缓存
		/*Yii::$app->cache->set("name",666);
		//获取缓存
		echo Yii::$app->cache->get("name");*/
		//删除缓存
		Yii::$app->cache->delete("name");
		//获取缓存
		echo Yii::$app->cache->get("name");
	}

}

0 人点赞