📄 export.php
字号:
<?php
include_once( "inc/auth.php" );
include_once( "inc/utility_all.php" );
$EXCEL_OUT = "部门名称,部门排序号,上级部门,部门电话,部门传真,部门职能\n";
$query = "SELECT * from DEPARTMENT order by DEPT_PARENT,DEPT_NO";
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$DEPT_NO = format_cvs( $ROW['DEPT_NO'] );
$DEPT_NAME = format_cvs( $ROW['DEPT_NAME'] );
$TEL_NO = format_cvs( $ROW['TEL_NO'] );
$FAX_NO = format_cvs( $ROW['FAX_NO'] );
$DEPT_PARENT = format_cvs( $ROW['DEPT_PARENT'] );
$DEPT_FUNC = "\"".format_cvs( $ROW['DEPT_FUNC'] )."\"";
if ( $DEPT_PARENT != 0 )
{
$query = "SELECT * from DEPARTMENT where DEPT_ID=".$DEPT_PARENT;
$cursor1 = exequery( $connection, $query );
if ( $ROW1 = mysql_fetch_array( $cursor1 ) )
{
$DEPT_PARENT = format_cvs( $ROW1['DEPT_NAME'] );
}
}
else
{
$DEPT_PARENT = "";
}
$EXCEL_OUT .= "{$DEPT_NAME},{$DEPT_NO},{$DEPT_PARENT},{$TEL_NO},{$FAX_NO},{$DEPT_FUNC}\n";
}
ob_end_clean( );
header( "Cache-control: private" );
header( "Content-type: application/vnd.ms-excel" );
header( "Accept-Ranges: bytes" );
header( "Accept-Length: ".strlen( $EXCEL_OUT ) );
header( "Content-Length: ".strlen( $EXCEL_OUT ) );
header( "Content-Disposition: attachment; filename= OA部门.csv" );
echo $EXCEL_OUT;
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -