phpcms怎么修改后台文章排序
2022-11-27 21:09:48
238
{{single.collect_count}}

phpcms修改排序的方法:首先找到“content.php”文件;然后直接修改代码为“$datas = $this->db->listinfo($where,'listorder ASC, id desc')”并刷新后台即可。

php入门到就业线上直播课:进入学习
Apipost = Postman + Swagger + Mock + Jmeter 超好用的API调试工具:点击使用

phpcms后台文章排序按自己输入的数字排列:

方法

打开phpcms的文件结构图,找到【phpcms\modules\content】中的content.php文件,注意:最好不要用记事本打开,使用sublime或者其他软件打开。我使用的是sublime

企业微信截图_15949529285039.png

代码太多了,使用快捷键【Ctrl+F】(这里是sublime软件的快捷键,其他软件不一定是这个哦)搜索【$datas = $this->db->listinfo($where,'id desc',$_GET['page']);】

企业微信截图_15949529352630.png

找到这行代码后:直接修改成【$datas = $this->db->listinfo($where,'listorder ASC, id desc',$_GET['page']);】,你也可以先注释原代码在后面加上一行,像我这种做法,万一代码出现问题可以修改回来。

企业微信截图_15949529404879.png

listinfo($where,'id desc',$_GET['page']);
登录后复制

注:原代码默认是使用ID倒序来排序的,

$datas = $this->db->listinfo($where,'listorder ASC, id desc',$_GET['page']);
登录后复制

修改后优先使用列表排序升序来排的

企业微信截图_15949529459401.png

刷新后台界面,重新排序后,在前台查看效果

企业微信截图_15949529503106.png

以上就是phpcms怎么修改后台文章排序的详细内容,更多请关注php中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}