1.
@小鸟的梦想,
//
@功能UBB,语言:c#
//正则
string at_re = @"@\d+(\[[^\]]+\])*";
re = new Regex(at_re);
//如果正则匹配到内容
if (re.IsMatch(content))
{
mc = re.Matches(content);
for (int i = 0; i < mc.Count; i++)
{
//分割到数组
string cs = mc
.Value.Split('@')[1], subcs = "";
//文本替换
try { subcs = cs.Split('[')[1].Replace("]", ""); cs = cs.Split('[')[0]; } catch { subcs = "暂无对话!"; }
//尝试获取信息
result = "<a title=\"对TA说:" + subcs + "\" href=\"" + PubConstant.GetHttpStart() + "wap/uinfo/zone.aspx?uid=" + cs + " \">@" + SomeData.GetUserInfo(cs, user).Nickname + "</a>";
content = content.Replace(mc.Value, result);
result = "";
}
4.
@小鸟的梦想,假设你已经有了发送内信的功能,则可以用如下方法实现at信息:
在用户发帖/回复的时候,检测帖子中的
@用户名 标记,如果发现,就用发帖/回复人的身份自动给指定用户发一条内信,内信中包括该帖子的内容提要及访问地址即可。