无锡seo网站推广费用,深圳百度seo优化,网络公司属于什么行业,做网站点子1、查询结果有中文会显示乱码。
解决方法一#xff08;较简单#xff0c;建议使用#xff09;#xff1a;
在php文件最开头写上#xff1a; header(Content-type: text/html; charsetUTF8); // UTF8不行改成GBK试试#xff0c;与你保存的格式匹配
?php
header(较简单建议使用
在php文件最开头写上 header(Content-type: text/html; charsetUTF8); // UTF8不行改成GBK试试与你保存的格式匹配
?php
header(content-type:text/html;charsetGBK); //设置编码 2、查询前对SQL转码
$sql SELECT 是是;
$sqliconv(UTF-8,GBK,$sql); 3、查询结果对含中文列转码
$stmt sqlsrv_query( $conn, $sql);
if($stmt){while( $row sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {echo iconv(GBK,UTF-8,$row[0]).br /;}
}
!DOCTYPE html
html
headmeta http-equivContent-Type contenttext/html; charsetutf-8 /title系统用户 | 访问记录/titlestyletable {border-collapse: collapse;font-family: Futura, Arial, sans-serif;}caption {font-size: larger;margin: 1em auto;}th, td {font-size: 12px;padding: .65em;}th {background: #555 nonerepeat scroll 0 0;border: 1px solid #777;color: #fff;}td {border: 1px solid#777;}th {background: #696969;color:#FFFFFF;}tbody tr:nth-child(odd) {background: #ccc;}/style
/head
body/body
/html?php
header(content-type:text/html;charsetutf-8);
//header(content-type:text/html;charsetGBK); //设置编码$serverName aliworks.cn,57468; //数据库服务器地址
$uid test_db; //数据库用户名
$pwd alibaba123456; //数据库密码
$connectionInfo array(UID$uid, PWD$pwd, DatabaseDBAliSys);
$conn sqlsrv_connect( $serverName, $connectionInfo);if( $conn false )
{ echo Could not connect.\n; die( print_r( sqlsrv_errors(), true));
} $tsql SELECT * FROM sys_Loguser order by LoginTime desc;
$stmt sqlsrv_query( $conn, $tsql);
if( $stmt false)
{ echo Error in query preparation/execution.\n; die( print_r( sqlsrv_errors(), true));
} echo table border0
tr
th日志ID/th
th用户名/th
th客户端IP/th
th服务器IP/th
th星期/th
th登录时间/th
th退出时间/th/tr;while( $row sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC))
{ echo tr;
echo td . $row[LogID] . /td;
//echo td . $row[UserName] . /td;echo iconv(GBK,UTF-8,td . $row[UserName] . /td);echo td . $row[ClientIP] . /td;
echo td . $row[ServerIP] . /td;
//echo td . $row[Weeks] . /td;
echo iconv(GBK,UTF-8,td . $row[Weeks] . /td);echo td . $row[LoginTime]-format(Y-m-d H:i:s) . /td;
echo td . $row[ExitTime]-format(Y-m-d H:i:s) . /td;/*
echo td .(.$row[X].,.$row[Y].)./td;
echo td . $row[Browser].$row[Browser_Version]. /td;
echo td . $row[Language] . /td;
echo td . $row[Equipment] . /td;
echo td . $row[Brand] . /td;
*/
echo /tr;} echo /table;
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?