Home > Backend Development > PHP Tutorial > discuz图片顺序混乱解决方案_PHP

discuz图片顺序混乱解决方案_PHP

WBOY
Release: 2016-05-30 08:47:40
Original
817 people have browsed it

说明

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的修改的全部内容了,希望对大家能够有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template