demo.php 434 B

1234567891011121314151617181920
  1. <?php
  2. include "wechat.class.php";
  3. $options = array(
  4. 'token'=>'tokenaccesskey' //填写你设定的key
  5. );
  6. $weObj = new Wechat($options);
  7. $weObj->valid();
  8. $type = $weObj->getRev()->getRevType();
  9. switch($type) {
  10. case Wechat::MSGTYPE_TEXT:
  11. $weObj->text("hello, I'm wechat")->reply();
  12. exit;
  13. break;
  14. case Wechat::MSGTYPE_EVENT:
  15. break;
  16. case Wechat::MSGTYPE_IMAGE:
  17. break;
  18. default:
  19. $weObj->text("help info")->reply();
  20. }