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">";
smarty截取中文乱码问题解决办法
smarty截取中文乱码问题解决办法
本文章提供了三款smarty截取中文乱码问题解决办法,关于乱码主要是在中文汉字中的处理了,我们利用了uft-8,gb2312等字符内码机制来截取字符串。
*/
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 二维数组排序与遍历
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;
}
php pdo连接mysql数据查询数据
html代码
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>
PHP中GBK和UTF8编码处理(中文,韩文)
一、编码范围
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]的字符
php 过滤所有HTML标记
//去除html标记
//清除html标记
php正则链接-取得内容所有链接
方法一
方法二
php mysql 导出csv excel格式文件并保存
$times = time();
$filename = $times.".csv";
$a = "联系人,联系电话,申请时间 ";
$days = postget("days");
$mktime = daystomktime($days);
$sql = "select * from v_tugou where ($times-times)<$mktime";
$db = new db();
$result = $db->query( $sql );
$rs = $db->fetch($result,0);
foreach($rs as $v=>$vv)
{
$a.=$vv['name'].','. $vv['mo'].",";
$a.=date('y-m-d ',$vv['times'])." ";
}
//echo $a;
$hod = fopen ($filename,"w+");
if( fwrite($hod,$a) )
{
echo "生成excel文件成功,点击<a href=$filename target=_blank>右击另存为excel文档</a>";
}
php连接mysql数据库的实用类
class mysql {
var $linkid=null;
function __construct($dbhost, $dbuser, $dbpw, $dbname = '', $dbcharset = 'gbk', $connect = 1) {
$this -> connect($dbhost, $dbuser, $dbpw, $dbname, $dbcharset, $connect);
}