zoukankan      html  css  js  c++  java
  • PHP网站记录

    手把手教您搭建Apache下的PHP环境

    http://www.makaidong.com/%E5%8D%9A%E5%AE%A2%E5%9B%AD%E6%8E%A8%E8%8D%90/37371.shtml

    http://httpd.apache.org/docs/2.4/platform/windows.html#winsvc

    PHP 教程

    http://www.w3school.com.cn/php/index.asp

    http://www.kokojia.com/course-3553.html

    微信开发教程 视频

    http://study.163.com/course/courseMain.htm?courseId=1003067001#/courseDetail?tab=1

    http://study.163.com/course/courseMain.htm?courseId=1003868040#/courseDetail?tab=1

    通讯AES加密

    https://www.cryptopp.com/wiki/Advanced_Encryption_Standard
    https://www.cryptopp.com/wiki/TripleDES#Sample_Programs

    微信加密sample
    https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1434696670

    微信php代码示例

     1 <?php
     2 /**
     3   * wechat php test
     4   */
     5 
     6 //define your token
     7 define("TOKEN", "weixin");
     8 $wechatObj = new wechatCallbackapiTest();
     9 $wechatObj->valid();
    10 
    11 class wechatCallbackapiTest
    12 {
    13     public function valid()
    14     {
    15         $echoStr = $_GET["echostr"];
    16 
    17         //valid signature , option
    18         if($this->checkSignature()){
    19             echo $echoStr;
    20             exit;
    21         }
    22     }
    23 
    24     public function responseMsg()
    25     {
    26         //get post data, May be due to the different environments
    27         $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
    28 
    29           //extract post data
    30         if (!empty($postStr)){
    31                 
    32                   $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
    33                 $fromUsername = $postObj->FromUserName;
    34                 $toUsername = $postObj->ToUserName;
    35                 $keyword = trim($postObj->Content);
    36                 $time = time();
    37                 $textTpl = "<xml>
    38                             <ToUserName><![CDATA[%s]]></ToUserName>
    39                             <FromUserName><![CDATA[%s]]></FromUserName>
    40                             <CreateTime>%s</CreateTime>
    41                             <MsgType><![CDATA[%s]]></MsgType>
    42                             <Content><![CDATA[%s]]></Content>
    43                             <FuncFlag>0</FuncFlag>
    44                             </xml>";             
    45                 if(!empty( $keyword ))
    46                 {
    47                       $msgType = "text";
    48                     $contentStr = "Welcome to wechat world!";
    49                     $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
    50                     echo $resultStr;
    51                 }else{
    52                     echo "Input something...";
    53                 }
    54 
    55         }else {
    56             echo "";
    57             exit;
    58         }
    59     }
    60         
    61     private function checkSignature()
    62     {
    63         $signature = $_GET["signature"];
    64         $timestamp = $_GET["timestamp"];
    65         $nonce = $_GET["nonce"];    
    66                 
    67         $token = TOKEN;
    68         $tmpArr = array($token, $timestamp, $nonce);
    69         sort($tmpArr);
    70         $tmpStr = implode( $tmpArr );
    71         $tmpStr = sha1( $tmpStr );
    72         
    73         if( $tmpStr == $signature ){
    74             return true;
    75         }else{
    76             return false;
    77         }
    78     }
    79 }
    80 
    81 ?>
    View Code
    作 者: itdef
    欢迎转帖 请保持文本完整并注明出处
    技术博客 http://www.cnblogs.com/itdef/
    B站算法视频题解
    https://space.bilibili.com/18508846
    qq 151435887
    gitee https://gitee.com/def/
    欢迎c c++ 算法爱好者 windows驱动爱好者 服务器程序员沟通交流
    如果觉得不错,欢迎点赞,你的鼓励就是我的动力
    阿里打赏 微信打赏
  • 相关阅读:
    WPF Caliburn 学习笔记(五)HelloCaliburn
    MSDN 教程短片 WPF 20(绑定3ObjectDataProvider)
    MSDN 教程短片 WPF 23(3D动画)
    比赛总结一
    HDU3686 Traffic Real Time Query System
    HDU3954 Level up
    EOJ382 Match Maker
    UESTC1565 Smart Typist
    HDU3578 Greedy Tino
    ZOJ1975 The Sierpinski Fractal
  • 原文地址:https://www.cnblogs.com/itdef/p/7592165.html
Copyright © 2011-2022 走看看