首页 > phper

PHP文件创建、复制、移动、删除文件

php代码

<?php session_start();
if($submit=="提交"){
$copy=$_post[copys];
$copys2=$_post[copy2];
if(copy($copy,$copys2)==true){echo "复制成功!!";}else{echo "失败!!";};
}
if($submit2=="提交"){
$moves=$_post[moves];
$moves2=$_post[moves2];
if(rename($moves,$moves2)==true){echo "移动成功!!";}else{echo "失败!!";};
}

阅读全文

php 生成excel文件

class excel{   
  
 
    var $header = "<?xml version="1.0" encoding="utf-8"?>
<workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/tr/rec-html40">";   

阅读全文

php 二维数组排序与遍历

function multi_array_sort($multi_array,$sort_key,$sort=sort_asc){  
    if(is_array($multi_array)){  
        foreach ($multi_array as $row_array){  
            if(is_array($row_array)){  
                $key_array[] = $row_array[$sort_key];  
            }else{  
                return -1;  
            }  
        }  
    }else{  
        return -1;  
    }  
    array_multisort($key_array,$sort,$multi_array);  
    return $multi_array;  

阅读全文

SMARTY 中文乱码解决方法

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>smarty 中文乱码解决方法</title>
</head>

阅读全文

php 文件上传实例代码

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.phprm.com/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

阅读全文