JietyWangZi 2016-05-12 13:54 采纳率: 0%
浏览 3093
已结题

想做一个文库网站,下载了一个MTCEO文库系统的源码,有一段读取SWF的代码不太懂,求大神帮助

function geturlipstr($ext,$filename){//获得预览代码,本地模式

if(file_exists('./' . C('mtceo_attach_path')."docswf/data/".$filename.".php")){
$ipstr=F($filename,'','./' . C('mtceo_attach_path').'docswf/data/');
}else{

        $urlarr=array();
        $urlarr[0]=$ext;
        $urlarr[1]=$filename;
        $urlarr[2]=C('mtceo_site_url');
        $urlpost=join('|',$urlarr);
        $data=file_get_contents('http://www.mtceo.net/index.php?m=common&a=getipstr&u='.$urlpost);
        $ipstrarr=json_decode($data,true);
        if($ipstrarr['status']==0){
            $ipstr="<div class=\"stl_01 mod reader-page complex reader-page-\"><div style=\"height:300px;font-size:30px;color:red;padding-top:150px;font-weight:bolder;text-align:center;\">".$ipstrarr['info']."</div></div>";
        }else{

            $ipstr=$ipstrarr['info'];
             F($filename,$ipstr,'./' . C('mtceo_attach_path').'docswf/data/');//缓存文件
        }


        }

return $ipstr;

}
function getipstr($ext,$filename){//获得预览代码,本地模式

 $extarr=array('xls','xlsx','ppt','pptx','dps','et');
 if(in_array($ext, $extarr)){

    $pngname='./' . C('mtceo_attach_path').'docswf/data/'.$filename.'/01.png';
    $filepath='./' . C('mtceo_attach_path').'docswf/data/'.$filename.'/';
    if(!file_exists('./' . C('mtceo_attach_path')."docswf/data/".$filename.".php")){ 
        if(file_exists($pngname)){//如果该文档存在,则取出字符串
            $opendir=opendir($filepath);
            $ipstr="<!--[if IE]>  <html class='ie'> <![endif]--><link rel='stylesheet' type='text/css' href='./public/images/docstyle.css' />";
        while ($file=readdir($opendir)){

            if(is_file($filepath.$file)){
                    if(strpos($filepath.$file, '.png')){
                        $ipstr.="<div class=\"stl_01 mod reader-page complex reader-page-\"><img src='".$filepath.$file."' /></div>";
                    }
                }

            }//经过循环已经得到$ipstr代码了
            F($filename,$ipstr,'./' . C('mtceo_attach_path').'docswf/data/');//缓存文件

        }
    else{

        //如果没有该文件则显示未生成预览
        $ipstr="<div class=\"stl_01 mod reader-page complex reader-page-\"><div style=\"height:300px;font-size:30px;color:red;padding-top:150px;font-weight:bolder;text-align:center;\">该文档尚未生成预览</div></div>";
    }   
 }//如果不存在缓存文件的判断结束
 else{

    $ipstr=F($filename,'','./' . C('mtceo_attach_path').'docswf/data/');

 }//存在缓存文件的判断结束


 }//以下将为生成html预览的部分
 else{

    $htmlname='./' . C('mtceo_attach_path').'docswf/data/'.$filename.'.html';


 if(!file_exists('./' . C('mtceo_attach_path')."docswf/data/".$filename.".php")){ 
        if(file_exists($htmlname)){//如果该文档存在,则取出字符串


            $ipstr=file_get_contents(HOST.__ROOT__ . '/' . C('mtceo_attach_path').'docswf/data/'.$filename.'.html');
            $ipstr=str_replace("<!DOCTYPE html>", '', $ipstr);
            $ipstr=str_replace("<html>", '', $ipstr);
            $ipstr=str_replace("</html>", '', $ipstr);
            $ipstr=str_replace("<meta charset=\"utf-8\" />", '', $ipstr);
            $ipstr=str_replace("<title>", '', $ipstr);
            $ipstr=str_replace("</title>", '', $ipstr);
            $ipstr=str_replace("<head>", '', $ipstr);
            $ipstr=str_replace("</head>", '', $ipstr);
            $ipstr=str_replace("<body>", '', $ipstr);
            $ipstr=str_replace("</body>", '', $ipstr);
            $ipstr=str_replace($filename.'_files', './' . C('mtceo_attach_path').'docswf/data/'.$filename.'_files', $ipstr);
            $ipstr=str_replace('stl_01', 'stl_01 mod reader-page complex reader-page-', $ipstr);


            //得到ipstr



            F($filename,$ipstr,'./' . C('mtceo_attach_path').'docswf/data/');//缓存文件
        }
    else{

        //如果没有该文件则显示未生成预览
        $ipstr="<div class=\"stl_01 mod reader-page complex reader-page-\"><div style=\"height:300px;font-size:30px;color:red;padding-top:150px;font-weight:bolder;text-align:center;\">该文档尚未生成预览</div></div>";
    }   
 }//如果不存在缓存文件的判断结束
 else{

    $ipstr=F($filename,'','./' . C('mtceo_attach_path').'docswf/data/');

 }//存在缓存文件的判断结束




 }

return $ipstr;

}

  • 写回答

2条回答 默认 最新

  • JietyWangZi 2016-05-12 14:01
    关注

    ".$filename.".php" 应该是什么内容才能使swf显示?

    评论

报告相同问题?

悬赏问题

  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?