Forgot password
 Register account
View 217|Reply 0

Discuz X 根据附件编号(aid)查询存储路径

[Copy link]

3226

Threads

7843

Posts

52

Reputation

Show all posts

hbghlyj posted 2022-5-4 02:40 |Read mode
$aidArray = C::t('forum_attachment_n')->fetch('aid:'.$aid, $aid, 1);

其中的三个参数,第一个用于查询该附件所在的数据表,第三个“1”表示为图片。

生成访问地址:
$pic = $_G['setting']['attachurl'].'forum/'.$aidArray['attachment'];
其中的 $_G['setting']['attachurl']为后台设置的附件URL,$aidArray['attachment']为第一步中读取到的附件存储路径。

转载自vdazhang.com/wenzhang-2341.html

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-23 09:36 GMT+8

Powered by Discuz!

Processed in 0.010591 seconds, 22 queries