<?php
echo "oci testing:1= <br />";
$conn = oci_connect('用户名', '密码', 'ip地址:端口号/实例名', 'gb2312'); // 建立连接"ZHS16GBK"if (!$conn) {
$e = oci_error();
print htmlentities($e['message']);
exit;
}
$query = 'SELECT * FROM USERS'; // 查询语句
$stid = oci_parse($conn, $query); // 配置SQL语句,准备执行
if (!$stid) {
$e = oci_error($conn);
print htmlentities($e['message']);
exit;
}
$r = oci_execute($stid, OCI_DEFAULT); // 执行SQL。OCI_DEFAULT表示不要自动commit
// echo base64_encode(serialize(oci_fetch_array($stid))); 
if(!$r) {
$e = oci_error($stid);
echo htmlentities($e['message']);
exit;
}
// 打印执行结果
print '<br />';
print '<table border="1">';// file_put_contents('11.txt', oci_fetch_array($stid, OCI_RETURN_NULLS));
while($row = oci_fetch_array($stid, OCI_RETURN_NULLS)) {
print '<tr>';
foreach($row as $item) {
print '<td>'.($item?htmlentities($item):' ').'</td>';
}
print '</tr>';
}
print '</table>';
oci_close($conn);?>返回结果如下:
中间的汉字全部为???,用base64转码查看了一下,似乎检索出来就是?号,用sqlplus检索数据时中文能正常显示。求大神指点哪里出了问题??