Home >Backend Development >PHP Tutorial >Implementation code for operating memcached cache in php to add, delete, modify and check data, phpmemcached_PHP tutorial

Implementation code for operating memcached cache in php to add, delete, modify and check data, phpmemcached_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:20:50893browse

The implementation code for operating memcached cache in php to add, delete, modify and check data, phpmemcached

Core code:

<&#63;php
	
	//创建一个memcache对象实例
	$memcache = new Memcache;
	if(!$memcache->connect("127.0.0.1",11211)){
		die('连接失败');
	}
	if($memcache->set('key1',"xian",MEMCACHE_COMPRESSED,60)){
		echo 'sucess!';
	}//存值,其中xian字符串,也可以为数组,对象,但不能为资源

	$val = $memcache->get('key1');//查询获取值
	echo $val;
	$memcache->replace('key1','beijing',MEMCACHE_COMPRESSED,60);//修改
	   $memcache->delete('key1');//删除
&#63;>

How to use php+MySQL to add, delete, modify and check the functionality of web pages? Just tell me the specific process

Hey, isn’t this just a small background operation?
Give me an idea: make a table, use a foreach loop to print out the table information at once, and present it in the table. Write edit and delete in the last two TDs of the table. As for adding, you need to Open a single page, pass the id when editing, take out all the values ​​​​of the id at once and pay the relevant value. Deletion is easier. Delete the row of data in the table according to the passed id
As for uploading pictures , then it needs to be encapsulated into the image processing library. You only need to pass the image name and perform related operations through the $_FILES global variable, such as determining the suffix and size of the uploaded file and the information presented to the customer after the upload fails.

php encapsulates a class to implement addition, deletion, modification and query of mysql database

It looks so messy!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/864475.htmlTechArticleThe implementation code for operating memcached cache in php to add, delete, modify and check data, phpmemcached core code: php//Create a memcache Object instance $memcache = new Memcache;if(!$memcache-connec...
Statement:
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