Home > Backend Development > PHP Tutorial > How to implement Yii cache clearing

How to implement Yii cache clearing

不言
Release: 2023-04-01 11:10:02
Original
1959 people have browsed it

This article mainly introduces the relevant information about the implementation method of PHP Yii clear cache. Here is an example of how to implement it. Friends in need can refer to it

PHP Yii clear cache implementation method

The example in this article describes how to clear the cache in Yii. Share it with everyone for your reference, the details are as follows:

html:

<button onclick="clearCache()">ClearCache</button>
Copy after login

js:

function clearCache()
{
 $.get(&#39;../eng/index.php?r=site/clear&&#39;+new Date().getTime(),function(){
  alert(&#39;Clear eng cache ok.&#39;);
 });
}
Copy after login

##php:

public function actionClear()
{
 Yii::app()->cache->flush();
}
Copy after login

The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

About Yii2.0 multi-file upload code

For Yii2.0 table association query analyze

The above is the detailed content of How to implement Yii cache clearing. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template