Description
When discuz publishes a post, it adds multiple pictures and then publishes the post directly. The order of the pictures sometimes gets messed up
Even if the order of the images in the upload image window is correct, they will still be messed up after publishing
Analysis
Look at the url, you can’t see anything in the program code
Change the picture name to serial number and upload it. The order is messed up. Note the order of the messed up pictures in the post: 76123458
Then find the bbs_forum_attachment_1 table in the database and find that the default order is also this:
I don’t even sort by aid. When I could pick it up, I just picked it up without ordering by
Find the php that directly operates this table: sourceclasstabletable_forum_attachment_n.php
Through the writelog('filename','log') method, it is found that every time the post is refreshed, fetch_all_by_id, this method is executed once
It turns out that when viewing a post, the attachment address that is not inserted into the post must be read from the database every time
Solution
Modify the default parameters passed in the fetch_all_by_id method: order_by='aid'
Refresh the post where the order of the pictures was messed up and found that the order is normal
The above is all about the modification of discuz. I hope it can be helpful to everyone.