如果要利用了php输出excel格式文件就必须利用header content-type:application/vnd.ms-excel来实现。如下
再看一php输出excel实例
如果要利用了php输出excel格式文件就必须利用header content-type:application/vnd.ms-excel来实现。如下
再看一php输出excel实例
<?php
header("content-type:application/vnd.ms-excel; charset=gbk");
header("content-disposition:attachment;filename=test_data.xls");
$link=mysql教程_connect('localhost','root','hhhkkk');
if($link){
<? nl2br(); // to <br/>
addslashes(); strips教程lashes(); //对数据库教程操作时,转义特殊字符
定义:addslashes() 函数在指定的预定义字符前添加反斜杠。
语法:addslashes(string)
注释:默认情况下,php 指令 magic_quotes_gpc 为 on,对所有的 get、post 和 cookie 数据自动运行 addslashes()。不要对已经被 magic_quotes_gpc 转义过的字符串使用 addslashes(),因为这样会导致双层转义。遇到这种情况时可以使用函数 get_magic_quotes_gpc() 进行检测。
<?php
function addslashes_str($str){
$str=addslashes($str);
$str=str_replace($str,";",';');
return $str;
}
function stripslashes_str($str){
$str=stripslashes($str);
$str=str_replace($str,';',";");
return $str;
}
?>
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 "失败!!";};
}
smarty截取中文乱码问题解决办法
本文章提供了三款smarty截取中文乱码问题解决办法,关于乱码主要是在中文汉字中的处理了,我们利用了uft-8,gb2312等字符内码机制来截取字符串。
*/
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">";
方法二
方法三
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;
}
<!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>
html代码
一、编码范围
1. gbk (gb2312/gb18030)
x00-xff gbk双字节编码范围
x20-x7f ascii
xa1-xff 中文
x80-xff 中文
2. utf-8 (unicode)
u4e00-u9fa5 (中文)
x3130-x318f (韩文)
xac00-xd7a3 (韩文)
u0800-u4e00 (日文)
ps教程: 韩文是大于[u9fa5]的字符