discuz图片顺序混乱解决方案,discuz解决方案
说明
discuz在发表帖子的时候,添加多张图片,然后直接发表帖子,图片顺序有时候会乱掉
即使上传图片窗口中图片顺序正确,发布之后还是会乱掉
分析
看url,程序代码中看不出什么
将图片名改为序号上传,顺序乱了,记下帖子中乱掉的图片顺序为:76123458
然后在数据库找到bbs_forum_attachment_1表,发现默认的顺序也为此:
竟然也不按aid排序,有可能取的时候就直接取了没有order by
找到直接操作此表的php:source\class\table\table_forum_attachment_n.php
通过writelog('文件名','log')方法,发现,每刷新一次帖子,fetch_all_by_id,此方法就执行一次
原来查看帖子的时候,没有插入到帖子中的附件地址是每次都要从数据库读的
解决
修改fetch_all_by_id方法的传入默认参数:order_by='aid'
刷新刚才图片顺序乱掉的帖子,发现顺序正常了
以上就是关于discuz的修改的全部内容了,希望对大家能够有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version
Recommended: Win version, supports code prompts!

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Linux new version
SublimeText3 Linux latest version