📄 export.php
字号:
<?php
include_once( "inc/auth.php" );
$str = "客户经理\t客户名称\t客户类型\t客户编号\t电话\t传真\t网址\t邮编\t规模\t地址\n";
if ( $_REQUEST['export_type'] )
{
$connection = openconnection( );
$cursor = exequery( $connection, $_REQUEST['query'] );
while ( $row = mysql_fetch_array( $cursor ) )
{
$manage_user = $row['MANAGE_USER'];
$customer_name = $row['CUSTOMER_NAME'];
$customer_type = $row['CUSTOMER_TYPE'];
$customer_number = $row['CUSTOMER_NUMBER'];
$tel_no = $row['TEL_NO'];
$fax_no = $row['FAX_NO'];
$customer_www = $row['CUSTOMER_WWW'];
$postalcode = $row['POSTALCODE'];
$scale = $row['SCALE'];
$province = $row['PROVINCE'];
$city = $row['CITY'];
$customer_add = $row['CUSTOMER_ADD'];
$query2 = "select USER_NAME from user where USER_ID='".$manage_user."'";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_row( $cursor2 ) )
{
$user_name = $row2[0];
}
switch ( $scale )
{
case "1" :
$scale = "微型(10人以下)";
break;
case "2" :
$scale = "小型(10-100人)";
break;
case "3" :
$scale = "中型(500-1000人)";
break;
case "4" :
$scale = "中小型(100-500人)";
break;
case "5" :
$scale = "大型(1000人以上)";
break;
default :
$scale = "";
break;
}
switch ( $customer_type )
{
case "1" :
$c_title = "正式客户";
break;
case "2" :
$c_title = "重要客户";
break;
case "3" :
$c_title = "潜在客户";
break;
case "4" :
$c_title = "无效客户";
break;
default :
$c_title = "无状态";
break;
}
$str .= $user_name."\t";
$str .= $customer_name."\t";
$str .= $c_title."\t";
$str .= $customer_number."\t";
$str .= $tel_no."\t";
$str .= $fax_no."\t";
$str .= $customer_www."\t";
$str .= $postalcode."\t";
$str .= $scale."\t";
$str .= $customer_add."\t\n";
}
}
ob_end_clean( );
header( "Cache-control: private" );
header( "Content-type: application/vnd.ms-excel" );
header( "Accept-Ranges: bytes" );
header( "Accept-Length: ".strlen( $str ) );
header( "Content-Disposition: attachment; filename=客户信息.xls" );
echo $str;
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -