Recently made a project, where there is demand, we have to implement this function: the goods when the delivery of text messages, the following small series to paste out the core code, the aspects of everyone later study.
HTML code omitted .....
Model code omitted .....
The core code is as follows:
/**-------------------------------------------------* Modify State public * AUTHOR:LZP time:--*---------------------------- ---------------------*/public function changestateaction () {$id = $_request[' id ']; $result = $this Changeconfirmstate ($id), if ($result) {$this->success ("modified successfully"),} else {$this->error ("modification Failed");}} Private Function Changeconfirmstate ($id) {$reg = $this->pricemodel->selectprice ([' id ' =>[' eq ', $id]]); $rel = $ This->demandmodel->selectdemand ([' id ' =>[' eq ', $reg [] [' demand_id ']]); $demand _id = $reg [] [' demand_id '];$ reg[' demand ' = $this->pricemodel->selectprice ([' demand_id ' =>[' eq ', $demand _id]]); foreach ($reg [' demand '] as $key = = $value) {if ($value [' phone '] = = $reg [] [' phone ']) {unset ($reg [' demand '] [$key]);} else{$new [] = $value [' Phone '];}} $new = [' = ' = ' ******** '];if (Time ()-strtotime ($rel [] [' Create_time ']) >) {echo "";d ie;} else if (Strtotime ($rel [] [' Finish_time ']) >) {echo "";d ie;} else{$data _demand = [' is_available ' = = ' finish_time ' =Date ("Y-m-d h:i:s")]; $result [' price '] = $this->pricemodel->saveprice ([' id ' =>[' eq ', $id]], [' State ' =>]); $result [' demadn '] = $this->demandmodel->savedemand ([' id ' =>[' eq ', $reg [] [' demand_id ']]], $data _demand); $ Mobile = Implode (",", $new); $content = "This demand has been sold, next time come yo!"; Smsapp ($mobile, $content); Send SMS return $result;}}
The above code is small to everyone paste the core code, the code is simple, so did not write too many comments, everyone in the reference process encountered any problems, welcome to my message, small series will respond to everyone in a timely manner, thank you for the support of this site!
The above describes the implementation of a product based on PHP to send short message functions, including the sending of text messages, PHP content, I hope that the PHP tutorial interested in a friend helpful.