Implementation code for adding, deleting, modifying and checking data by operating memcached cache in php

This article mainly introduces the implementation code of operating memcached cache in php to add, delete, modify and query data. Friends who need it can refer to it Core code: connect(“127.0.0.1″,11211)){ die(‘connection failed’); } if($memcache->set(‘key1’,”xian”,MEMCACHE_COMPRESSED,60)){ echo ‘sucess!’; }//Store value, where xian is a string, it can also be an array, an object, but not a resource $val = $memcache->get(‘key1’);//query to get the value echo $val; $memcache->replace(‘key1′,’beijing’,MEMCACHE_COMPRESSED,60);//Modify $memcache->delete(‘key1’);//Delete ?>

What else can php do besides adding, deleting, modifying and checking-PHP problem

What else can php do besides adding, deleting, modifying and checking? You can study the architecture. There are many aspects of routing and interfaces. Study the bottom layer of some open source frameworks? And in fact, there are many different scenarios for adding, deleting, modifying and changing the business layer, and the logic and business requirements of the business layer are also very diverse. If you really feel that you have nothing to do, you can get in touch with some other frameworks and languages, and you can check out more websites like PHP Chinese Network. The above is the detailed content of what php can do besides adding, deleting, modifying and checking. For more, please pay attention to other related articles on 1024programmer.com!

technical image

thinkphp3.2.3 simple implementation of adding, deleting, modifying and checking

Case Screenshot: Detailed explanation: 1) Application/ Create a new controller file AjaxController.class.php in the Admin/Controller/ directory 1 <?php 2 namespace Admin\Controller; 3 use Think\Controller; 4 class AjaxController extends Controller { 5 6 public function ajaxuser(){ 7 $info = ‘Age can only write numbers’; 8 $this->assign(‘info’, $info);//Parameter 1: the variable used by the template value, parameter 2: the value to be passed 9 $this->display();//default output current template10 }11 12 //Add new user to handle ajax transmission User information13 public function adduser(){ 14 $model = M(‘user’);// M instantiates the object model (the efficiency of D is lower, but the function is powerful )15 $data[‘user’] = I(‘post.user’);// I receive the passed value16 $data[‘age’] = I(‘post.age’); 17 $res = $model->add($data );18 if ($res) { 19 $this->ajaxReturn(‘add successfully’,’eval’);//eval is a string format 20 }else{21 $this-> ajaxReturn(‘Add failed’,’eval’);22 }23 }24 25 //Query users 26 public function showuser(){27 $ model = M(‘user’);28 $res = $model ->select();29 //dump($res);30 $this->assign(‘res’,$res);31 $this->display();32 33 }34 //Modify user35 public function updateuser(){36 $model = M(‘user’);37 $id = I(‘get.id’);//Get The id passed from the showuser page38 if (IS_GET) {39 span> $fd = $model->find($id); // get id Corresponding user data40 $this->assign(‘fd’,$fd); 41 $this->display();42 }43 44 if (IS_POST) { 45 //dump($id);exit;46 $data span>[‘id’] = $id;//Updated conditions47…

PHP realizes the function of adding, deleting, checking and modifying the database and the complete code

This article uses: jquery, tp framework TP_3.2.2/Application/Home/Controller/StuController.class.php display(“school/stu”); } public function getdata(){ $Studata = M(‘stu’); $data[‘id’] = ”; $data[‘name’]=I(‘get.name’); $data[‘age’]=I(‘get.age’); $data[‘num’]=I(‘get.num’); $data[‘address’]=I(‘get.add’); $Studata->add($data); $this->success(“is…”, U(‘Stu/showdata’)); } public function showdata() { $Studata = M(‘stu’); $data=$Studata->select(); $this->assign(‘info’,$data); $this->display(‘school/showdata’); } public function del(){ $id = I(‘get.id’); $Studata = M(‘stu’); $bool = $Studata->where([‘id’=>$id])->delete(); if ($bool){ echo 1; }else{ echo 0; } } public function updata() { $id = I(‘get.id’); $Studata = M(‘stu’); $data = $Studata->where([‘id’=>$id])->find(); $this->assign(‘data’, $data); $this->display(“school/upshowdata”); } public function updatadeal() { $Studata = M(‘stu’); $id = I(‘get.id’); $data[‘name’]=I(‘get.name’); $data[‘age’]=I(‘get.age’); $data[‘num’]=I(‘get.num’); $data[‘address’]=I(‘get.add’); $bool = $Studata->where([‘id’=>$id])->save($data); if ($bool){ $this->showdata(); }else{ echo 0; } } } TP_3.2.2/Application/Home/View/school/showdata.html Student information display Number Name age Student Number Hometown Operation Operation {$vo[‘id’]} {$vo[‘name’]} {$vo[‘age’]} {$vo[‘num’]} {$vo[‘address’]} Delete Modify Edit: Summary The above is the function of adding, deleting, checking and modifying the database and the complete code introduced by the editor to you. I hope it will be helpful to you. If you have any questions, please leave me a message, and the editor will reply to you in time. Thank you very much for your support to the website!

Insert picture description here

PHP+ajax realizes uploading, deleting, modifying a single picture and detailed explanation of background processing logic operations

This article describes the PHP+ajax implementation of uploading, deleting, modifying a single image and background processing logic operations. Share it with everyone for your reference, as follows: 2019-07-04 update Reason for update and modification: The ui display of the front interface is not good The background processing logic is confusing, and it is troublesome to process multiple pictures, so it is modified to upload/delete pictures through ajax. Effect: Before upload: After uploading: After revocation: Here is the updated code: HTML Code: Thumbnail Upload picture withdraw image Key points: The key points are all in the comments. Reference: JS+HTML implements a custom upload image button and displays images JS Code: //upload image //Listen to input[type=file] $(“input[name=pic]”).on(‘change’, function () { var e=$(this); var file=e[0].files[0]; var formData = new FormData(); formData.append(“pic”,file);//The name assigned to the picture here should correspond to the post value received in the following php $.ajax({ url: “{:url(‘upimg’)}”, type: ‘POST’, cache: false, //Upload files do not need to be cached data: formData, processData: false, // Tell jQuery not to process the sent data (specify whether the data sent through the request is converted to a query string. The default is true.) contentType: false, // Tell jQuery not to set the…

A simple example of adding, deleting, modifying and checking PHPMySql

mysql_connect() to connect to the database mysql_select_db select database mysql_fetch_assoc() to get the result set mysql_query() executes sql statement Examples are as follows: <?php $con=@mysql_connect('localhost','root','root');//Connect to the database mysql_select_db('test', $con);//select database $userInfo=mysql_query("select * from user", $con);//create sql statement echo "”; while($row=mysql_fetch_assoc($userInfo))//Get the data of each row of the result set { echo “”; echo “”; echo $row[‘id’];//Get the id in the row echo “”; echo “”; echo $row[‘username’]; echo “”; echo “”; echo $row[‘password’]; echo “”; echo “”; } echo “”; mysql_free_result($userInfo);//Release the result set mysql_close($con); //Close the database /*delete $d=@mysql_connect(‘localhost’,’root’,’root’); mysql_select_db(‘test’, $d); mysql_query(“delete from user where id=1”, $d); mysql_close($d); */ /*insert $i=@mysql_connect(‘localhost’,’root’,’root’); mysql_select_db(‘test’, $i); mysql_query(“insert into user(username,password) values(‘ad’,’ad’)”,$i); mysql_close($i); */ //update $u=@mysql_connect(‘localhost’,’root’,’root’); mysql_select_db(‘test’, $u); mysql_query(“update user set username=’aaa’ where username=’00′”, $u); echo “update user set username=’ax’ where id=2”; mysql_close($u); ?> The above simple example of adding, deleting, modifying and checking PHP MySql is all the content shared by the editor. I hope it can give you a reference, and I hope you can support it.

Implementation code for adding, deleting, modifying and checking data by operating memcached cache in php

Core code: connect(“127.0.0.1″,11211)){ die(‘connection failed’); } if($memcache->set(‘key1’,”xian”,MEMCACHE_COMPRESSED,60)){ echo ‘sucess!’; }//Store value, where xian is a string, it can also be an array, an object, but not a resource $val = $memcache->get(‘key1’);//query to get the value echo $val; $memcache->replace(‘key1′,’beijing’,MEMCACHE_COMPRESSED,60);//Modify $memcache->delete(‘key1’);//Delete ?>

Analysis of the implementation method of php adding, deleting, modifying and checking operations on xml files

The example in this article describes the implementation method of adding, deleting, modifying and checking operations of xml files by php. Share it with everyone for your reference, as follows: xml source file 2016-08-01 File content $file=’callBoard.xml’; Query xml: $doc=new DOMDocument();//Instantiate the object $doc->load($file);//Load file $data=array(); $time=$doc->getElementsByTagName(“endTime”);//Get element is title $dateTime=$time->item(0)->nodeValue;//Get the value of the specified element $cOntent=$doc->getElementsByTagName(“content”);//Get element is title $dataCOntent=$content->item(0)->nodeValue;//Get the value of the specified element Update and create: if(file_exists($file))//judging whether the file exists { //Update the content if it exists $doc=new DOMDocument();//Instantiate the object $doc->load($file);//Load file $resultDate=$doc->getElementsByTagName(“endTime”);//Get element is dateNumber $resultDate->item(0)->nodeValue=$_POST[‘time’];//Assign value to the specified element $resultBall1=$doc->getElementsByTagName(“content”);//Get element is ball1 $resultBall1->item(0)->nodeValue=$_POST[‘content’];//Assign value to the specified element $doc->save($file);//This method is only used when it is useful to modify } else { //Create the file if it doesn’t exist $doc=new DOMDocument(‘1.0′,’utf-8’);//declaration is XML $doc->formatOutput=true;//format output $root=$doc->createElement(‘root’);//Create root element $endTime=$doc->createElement(“endTime”,$_POST[‘time’]);//Create element dateNumber and assign $arr[‘resultDate’] content $cOntent=$doc->createElement(“content”,$_POST[‘content’]);//Create element ball1 and assign $arr[‘resultBall1’] content $root->appendChild($endTime);//$content element contains $dateNumber element $root->appendChild($content);//$content element contains $ball1 element $doc->appendChild($root);//End the establishment of the root element $doc->save($file);//Generate xml.xml file } PS: Here are a few more online tools for xml operations for your reference: Online XML/JSON conversion tool: http://tools.jb51.net/code/xmljson Online Formatting XML/Online Compression XML: http://tools.jb51.net/code/xmlformat XMLOnline…

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

Implementation code for adding, deleting, modifying and checking data by operating memcached cache in php, phpmemcached

php tutorial | php manual php, memcached, cache, mysql database php tutorial-php manualOperating memcached cache in php to add, delete, modify and check data implementation Code, phpmemcached drawing management source code, how to run vscode offline, where to download ubuntu, put applets in tomcat, jasmine crawler, php iconv garbled code, Taishan seo optimization promotion software, vs website template download address, template Home file management lzw core code: source library download address, ubuntu how to partition reasonably, crawler network anti-crawling, php fromxml, seo chart software lzw connect(“127.0.0.1″, 11211)){ die(‘connection failed ‘); } if($memcache->set(‘key1’,”xian”,MEMCACHE_COMPRESSED,60)){ echo ‘sucess!’; }//Store value, where xian is a string, it can also be an array, an object, But not for resource $val = $memcache->get(‘key1’);//Query to get value echo $val; $memcache->replace(‘key1′,’beijing’,MEMCACHE_COMPRESSED,60);//Modify $ memcache->delete(‘key1’);//Delete?> How to extract the source code of the mail, which plug-ins should be installed in vscode, ubuntu font box, tomcat thread number adjustment, python crawler public opinion, php factory design mode, Dashiqiao SEO optimization promotion software, nz website source code transaction, ecshop template supports php code lzw How to use php+MySQL to realize the addition, deletion, modification and checking of web pages? Just talk about the specific process Hey, isn’t this just a small background operation.…

PHP implements the five basic operations of displaying, adding, modifying, deleting, and querying text database data.

<?php /**php realizes data display and addition to the text database , modify, delete, query the five basic operation methods. There are 9 fields in this text database: private $bankid; //Bank ID private $bankname; //Bank name private $bankimg; //bank image private $bankarea; //coverage area private $bankcard; //Accept card types private $banklimit; //payment limit private $bankpasswd; //transaction password private $banknote; //Bank information notes private $bankmiss; //Other information about the bank. @abstract TxtDB store@access public@author [email protected] .cn */ class TxtDB { private$bankid; //Bank ID private$bankname; //bank name private$bankimg; //bank image private$bankarea; //coverage area private$bankcard; //Accept card private$banklimit; //payment limit private$bankpasswd ; //transaction password private$banknote; //bank information notes private$bankmiss; //Other bank information publicfunction __construct() { $bankid= “” ;//Bank ID $bankname= “”;//Bank name $bankimg= “”;//bank image $bankarea= “”;//coverage area $bankcard= “”;//accept card types $banklimit = “”;//payment limit $bankpasswd= “”;//transaction password Type $banknote= “”; //Bank information notes $bankmiss= “”;//Other bank information } /** * Add data program segment. * $bankinfo array Bank information to be inserted List * $bankinfo[“bankid”] $bankinfo[“bankname”]$bankinfo[“bankimg”]$bankinfo[“bankarea”] * $bankinfo[“bankcard”]$bankinfo[“banklimit”] * $bankinfo[“bankpasswd”]$bankinfo[“banknote”]$bankinfo[“bankmiss”] * @return boolean success true * failed false */ publicstatic functioninsert($bankinfo) { $date= date ( “Y-m-d H:i:s” );//Get system time foreach($bankinfo as $key => $value ) { $key= trim ( $value…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索