_php instance of sending short message function based on PHP to realize merchandise transaction

Source: Internet
Author: User

Recently done a project, which has the demand, requires us to achieve this function: when the goods are sold, the following small edit the core code, aspects of learning.

HTML code omitted .....

Model code omitted .....

The core code looks like this:

  * *-------------------------------------------------* Modify Status Public * AUTHOR:LZP time:--*------------------------- ------------------------*/Public Function changestateaction () {$id = $_request[' id '); $result = $this->changeconfir
Mstate ($id);
if ($result) {$this->success ("modified successfully");} else {$this->error ("Modify 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 <script>alert (' timed out! ');
History.back ();</script> ";
Die }else if (Strtotime ($rel [] finish_tIME '] >) {echo <script>alert (' Closed! ');
History.back ();</script> ";
Die }else{$data _demand = [' is_available ' =>, ' finish_time ' => date ("y-m-d h:i:s")]; $result [' price '] = $this->pri
Cemodel->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 Yo!"; Smsapp ($mobile, $content);
Send text message return $result;  }
}

The code above is a small part of the code to put together the core, the code is also simple, so did not write too many comments, everyone in the reference process encountered any problems, welcome to my message, small series will promptly reply to everyone, in this very grateful to the cloud Habitat Community support site!

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.