Php implements code for adding, deleting, modifying, and querying data through the memcached cache. phpmemcached_PHP tutorial

Source: Internet
Author: User
Tags image processing library
Php implements code for adding, deleting, modifying, and querying data through the memcached cache, phpmemcached. Php implements code for adding, deleting, modifying, and querying data through memcached caching. phpmemcached core code: php creates a memcache object instance $ memcachenewMemcache; if (! $ Memcache-connec php implements code for adding, deleting, modifying, and querying data by operating on the memcached cache, phpmemcached

Core code:

<? Php // Create a memcache object instance $ memcache = new Memcache; if (! $ Memcache-> connect ("127.0.0.1", 11211) {die ('connection failed');} if ($ memcache-> set ('key1', "xian ", MEMCACHE_COMPRESSED, 60) {echo 'sucess! ';} // Save the value. The xian string can also be an array and an object, but cannot be a resource $ val = $ memcache-> get ('key1 '); // query the obtained value echo $ val; $ memcache-> replace ('key1', 'beijinging', MEMCACHE_COMPRESSED, 60 ); // modify $ memcache-> delete ('key1'); // delete?>


How can I use php + MySQL to add, delete, modify, and query webpages? Let's talk about the specific process.

Isn't that a small background operation.
Let's give a thought: create a table, print the information of the table in a foreach loop at a time, and present it in the table. write edit and delete in the last two td files of the table, as for the addition, you need to open the page. when editing, pass the id to the past, retrieve all the values of the id at a time and pay the relevant value. this is easier to delete, delete the row of data in the table based on the uploaded id.
As for uploading images, you need to encapsulate them into the image processing library. you only need to pass the image name and perform related operations using the $ _ FILES global variable, such as determining the suffix, size, and information presented to the customer after the upload fails.

Php encapsulates a class to add, delete, modify, and query mysql databases.

Look messy!

Idea core code: php // Create a memcache object instance $ memcache = new Memcache; if (! $ Memcache-connec...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.