PHP micro-Credit development platform Development Quiz

Source: Internet
Author: User
Tags cdata
PHP Development Platform Development Small test
and the resulting open platform has recently been a bit of a fire. Always want to make a platform to try, recently had a good idea, want to get it out as soon as possible, fortunately do not need any UI and so on the design, only need to put the logic to show it. In fact, if the public platform only as a platform for publishing information, that is, "edit mode" is actually no need to knock code. Just in developer mode, developers need to design certain logic and code to implement specific functions, the next step is the development of the start:


1. The development of the public platform first to have server resources, of course, the kind of editing mode does not count. The so-called editing mode is the simple public account that pushes a message every day. Server resources All kinds of cloud servers are available, recommended bae/sae/nut/Ali, and so on, each has the advantage, and because of competition for the sake of? There will be some free resources both hands, to practice practiced hand is enough.

A. Apply for BAE account, create the application, if it is test, go to the homepage of the public platform to download the test PHP Code, just change the token into your token. For example, the following PHP test code, the logic of the code is clear, that is, a validation process, can also define a part of the logical operation. Upload this file and create your own app version 1:


 Valid (); Class Wechatcallbackapitest{public function valid () {$echoStr = $_get["Echostr"];//valid signature, optionif ($ This->checksignature ()) {echo $echoStr; exit;}} Public Function responsemsg () {//get post data, May is due to the different environments$poststr = $GLOBALS ["Http_raw_post_ DATA "];//extract Post Dataif (!empty ($POSTSTR)) {$POSTOBJ = simplexml_load_string ($postStr, ' simplexmlelement ', LIBXML _nocdata); $fromUsername = $postObj->fromusername; $toUsername = $postObj->tousername; $keyword = Trim ($POSTOBJ- >content); $time = time (); $TEXTTPL = "
 
   
    
    %s 0 
    %s 
 
    
    %s 
 
    
    %s 
 
    
    %s 
 
    
 
 
 
 
 
 

  
 "; if (!empty ($keyword)) {$msgType =" text "; (PS: ^_^ Good PHP Learning Exchange Group: 276167802, verify: CSL, interested can join in the discussion together) $contentStr = "Welcome to WeChat world!"; $RESULTSTR = sprintf ($TEXTTPL, $fromUsername, $toUsername, $time, $msgType, $contentStr); echo $resultStr;} Else{echo "Input something ...";} else {echo ""; exit;}} Private Function Checksignature () {$signature = $_get["signature"]; $timestamp = $_get["timestamp"]; $nonce = $_get[" Nonce "]; $token = token, $TMPARR = Array ($token, $timestamp, $nonce); sort ($TMPARR); $tmpStr = implode ($TMPARR); $tmpStr = sh A1 ($TMPSTR); if ($tmpStr = = $signature) {return true;} Else{return false;}}? >

when the new version is created successfully, the app is created successfully:



I hope this article on the vast PHP DeveloperHelpful, thanks for reading this article.

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