帝国CMS安装有移动端同步生成插件的同步删除手机文件方法

时间:2023年08月10日

/

来源:网络

/

编辑:佚名

在安装有帝国CMS移动端同步插件在后台删除信息后手机端其实并没有同步删除,现在我们通过修改系统默认文件来实现这个功能。
在没修改前需要手工去手机端目录去删除文件,现在终于有方法解决了这个问题,代码如下:
找到文件件e/class/functions.php,查找"function DelNewsFile",找到函数DelNewsFile,把开头和结尾中间部分替换成以下代码:
function DelNewsFile($filename,$newspath,$classid,$newstext,$groupid=0){
global $class_r,$addgethtmlpath,$mob_r; 
include_once ECMS_PATH."e/dongpo/mob/config.php"; //文件类型
if($groupid)
{
$filetype=".php";
}
else
{
$filetype=$class_r[$classid][filetype];
}
//是否有日期目录
if(empty($newspath))
{
$mynewspath="";
}
else
{
$mynewspath=$newspath."/";
}
$iclasspath=ReturnSaveInfoPath($classid,$id);
$r=explode("",$newstext);
    for($i=1;$i<=count($r);$i++)
    {
        if(strstr($filename,'/'))
        {
            DelPath(eReturnTrueEcmsPath().$iclasspath.$mynewspath.ReturnInfoSPath($filename));
            DelPath($mob_r['msitepath'].$iclasspath.$mynewspath.ReturnInfoSPath($filename));
        }
        else
        {
            if($i==1)
            {
                $file=eReturnTrueEcmsPath().$iclasspath.$mynewspath.$filename.$filetype;
                $mfile=$mob_r['msitepath'].$iclasspath.$mynewspath.$filename.$filetype;
            }
            else
            {
                $file=eReturnTrueEcmsPath().$iclasspath.$mynewspath.$filename."_".$i.$filetype;
                $mfile=$mob_r['msitepath'].$iclasspath.$mynewspath.$filename."_".$i.$filetype;
            }
            DelFiletext($file);
            DelFiletext($mfile);
        }
    }
}
说明:
(1)以上蓝色部分代码是新增的,你也可以仅增加蓝色部分代码。
(2)对于没有使用过78模板网移动端同步生成插件的帝国程序也可以使用,需要将上述代码中的 $mob_r['msitepath'] 修改成自己的移动端绝对地址。
猜你需要

豫ICP备2021026617号-1  豫公网安备:41172602000185   Copyright © 2021-2028 www.78moban.com/ All Rights Reserved

本站作品均来自互联网,转载目的在于传递更多信息,并不代表本站赞同其观点和对其真实性负责。如有侵犯您的版权,请联系 1565229909#qq.com(把#改成@),我们将立即处理。