1.数据库操作
文件名processor.php
<?php
defined(‘IN_IA‘) or exit(‘Access Denied‘);
class RegisterModuleProcessor extends WeModuleProcessor{
$sql = "select * from ".tablename(‘register‘)." where openid = :openid";
$array = array(‘:openid‘=>$oepnid);
if($res = pdo_fetch($sql,$array)){
$msg = "你已经注册,\n注册名是:".$res[‘name‘];
}else{
preg_match_all(‘/^报名(.+)‘,$content,$matches);
$res = pdo_insert(‘register‘,array(‘openid‘=>$openid,‘name‘=>$matches[1][0]));
if($res){
$msg = ‘注册成功!‘;
}
}
return $this->respText($msg);
}
时间: 2024-10-16 07:04:15