咨询一下发帖相关的hook
modu 1天前

我写了一个插件,安装卸载都没问题,字段能够导入数据库,但是现在的遇到的问题是发帖的时候无法把数据插入 $thread 数组,导致没办法把数据写进数据库,而且我的 hook 文件名(thread_create_thread_before.php)也是对的,到底是啥原因呢?

我的 hook 代码

// 获取 `user-agent` 来判断客户端类型
$ua = strtolower($_SERVER['HTTP_USER_AGENT'] ?? '');
$client_type = 'web'; // 默认值是 web

// 判断客户端类型
if (strpos($ua, 'android') !== false) {
    $client_type = 'android';
} elseif (strpos($ua, 'iphone') !== false || strpos($ua, 'ipad') !== false) {
    $client_type = 'ios';
} elseif (strpos($ua, 'windows') !== false || strpos($ua, 'macintosh') !== false) {
    $client_type = 'pc';
}

$thread['client_type_t'] = $client_type;


插入hook


请大佬指点一下

最新回复 (4)
全部楼主
  • modu 楼主
    1天前 2
    0
    主要想实现发帖/回复的时候自动获取协议头判断来源然后存到帖子的字段中
  • Tillreetree 版主
    18小时前 3
    0
    线索:你需要在thread表里添加一列,才能写入
  • Tillreetree 版主
    17小时前 4
    0
    https://www.xiunobbs.cn/thread-6883.htm
  • modu 楼主
    13小时前 5
    0
    Tillreetree 线索:你需要在thread表里添加一列,才能写入
    你说的是插入字段吗?可是表里有这个字段了,还是无法写入
返回
modu
二级用户组
11
主题数
73
帖子数
扫码访问