你好
非常感谢帮我解决这个问题,但是你的那种解决方法只能解决帖子不存在时的404,而且还是转到新页面。
我自己根据你的提示改了一下代码,效果没问提就是不知道有没有什么后遗症,请指点一二。
我在source\function\function_message.php文件中的dshowmessage()函数里对参数$message
进行判断,当需要返回404时直接把状态码设置成404,页面还显示以前的页面。
添加代码如下:
- $NotFoundCase = array(
- 'thread_nonexistence' , // '抱歉,指定的主题不存在或已被删除或正在被审核',
- 'debate_nofound' , // '抱歉,该辩论主题不存在',
- 'space_does_not_exist' , // '抱歉,您指定的用户空间不存在',
- 'forum_nonexistence' , // '抱歉,指定的版块不存在',
- 'article_not_exist' , // '抱歉,指定的文章不存在',
- 'topic_not_exist' , // '抱歉,指定的专题不存在',
- 'post_nonexistence' , // '帖子不存在',
- 'to_view_the_photo_does_not_exist' , // '抱歉,您要查看的相册不存在或正在审核',
- 'album_does_not_exist' , // '抱歉,指定的相册不存在',
- 'eccredit_nofound' , // '指定的评价不存在或已被删除',
- 'view_images_do_not_exist' , // '抱歉,您要查看的图片不存在或正在审核',
- 'view_to_info_did_not_exist' , // '抱歉,您要查看的信息不存在或已被删除',
- 'threadmod_nonexistence' , // '抱歉,主题管理记录不存在或已过期删除',
- 'post_check' , // '抱歉,指定的帖子不存在或已被删除或正在被审核',
- 'article_deleted' , // '文章已删除',
- 'member_nonexistence' , // '抱歉,指定的用户不存在或已被删除',
- 'eccredit_order_notfound' , // '抱歉,您指定的订单不存在或已被删除',
- 'admin_merge_nonexistence' , // '抱歉,主题 ID (tid) 不存在',
- 'admin_stickreply_invalid' , // '抱歉,目标帖子不存在或者为主题',
- 'sharing_does_not_exist' , // '抱歉,评论的分享不存在',
- 'comment_comment_noexist' , // '抱歉,要评论的文章不存在'
- 'blog_does_not_exist' , // '抱歉,指定的日志不存在',
- 'feed_no_found' , // '抱歉,您指定要查看的动态不存在',
- 'view_article_no_exist' , // '抱歉,您指定要查看的文章不存在或正在审核',
- 'list_category_noexist' , // '抱歉,您指定要查看的分类不存在',
- );
- if(in_array($message,$NotFoundCase))
- {
- Header('HTTP/1.0 404 Not Found');
- }
复制代码
|