Forgot password?
 Register account
View 217|Reply 0

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

[Copy link]

3158

Threads

7933

Posts

45

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 | 快速注册

$\LaTeX$ formula tutorial

Mobile version

2025-6-8 06:38 GMT+8

Powered by Discuz!

Processed in 0.015164 second(s), 21 queries

× Quick Reply To Top Edit