PHP访问Oracle乱码!解决方案
Jun 13, 2016 am 10:03 AM
PHP访问Oracle乱码!
Oracle 11 环境:NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK;
PHP 5 default_charset "gb2312"
连接字符:$conn = oci_connect('scott', 'tiger', 'demo', 'zhs16gbk');
//注:后面的‘zhs16gbk‘加不加都不行,或改成'zhs16cdb231280','utf-8'都不行。
SQL*Plus:没问题
PHP:本身没问题
从PHP中INsert into……没问题
网页是IE7(IE6也试过),编码是简体中文GB2312。
可查询出的结果,英语显示正常,汉字都是乱码,折腾了几天了,还 是搞不定,那位有经验帮一下,先谢谢!
环境:Vista+Oracle 11+Php 5+ Apache 2.2.8
在XP下也试过不行。
------解决方案--------------------
还是你自已查一下oracle手册关于字符集的设置吧!
其次就是数据库中的字符集要和页面输出端的字符集一致!
------解决方案--------------------
查看———》编码———》自动选择
一般都是utf-8
------解决方案--------------------
在头上加上
就可以了
我想是因为你的文件不是utf-8的
------解决方案--------------------
再加个环境变量
NLS_NCHAR=ZHS16GBK
------解决方案--------------------
加个环境变量
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
重新启动机器
------解决方案--------------------
------解决方案--------------------
还有一个地方是
数据库表的定义是不是utf-8 ?
你把代码贴出来看下好了,乱猜没有用的
那样比较明朗些.

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Function to calculate the number of days between two dates in oracle

How long will Oracle database logs be kept?

The order of the oracle database startup steps is

How to see the number of occurrences of a certain character in Oracle

Oracle database server hardware configuration requirements
