PHP-based implementation of the commodity transaction when sending SMS function PHP SMS Verification Code platform PHP SMS Verification Code software PHP SMS Verification Code Pass

Source: Internet
Author: User
Tags php sms verification
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.

  • 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.