依崇稀

导航

 

关于文档的下载查看以及删除

js部分

<td><span class="cur bucolor" onclick="showDetail(\"+arr2[0]+'\')查看</span>'+(userid="sysmaster'"?" onclick="delDetail('\"+arr2[0]+'\)">删除</span>':'')+"</span>+(arr2[6]=="end'? onclick="download(\"+arr2[4]+'\,\''+arr2[6]+"\")">下载</span':'')+'</td>\

//json转word文档的下载与读取

case ‘down’:

$resultpath=$_POST['resultpath'];

if(file_exists($resultpath)){

$res=fopen($resultpath,'r');

$content=fread($res,filesize($resultpath));

$arr=json_decode($contern,true);

if($res){

$word=fopen('res.doc'.'w');

$rst=recursive_array($arr);

fwrite($word,$str);

//遍历循环

function recursive_array($config){

foreach($config as $key=$val){

$tmp=$oppo[$key]?$oppo[$key}:$key;

if(is_array($val){

if(!is_numeric($key)){

if($val){

$rst.='<h1>'.$tmp.':</h1><br/>";

}

}

$rst .=recursive_array($val);

}else{

if($val){

$rst.=$tmp.':'.$val."<br/>";

}

}

$rst .='</html>';

return $rst;

 

 

posted on 2020-07-07 19:00  依崇稀  阅读(109)  评论(0)    收藏  举报