Home Backend Development PHP Tutorial PHP访问Oracle乱码!解决方案

PHP访问Oracle乱码!解决方案

Jun 13, 2016 am 10:03 AM
charset content oracle quot

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 ?
你把代码贴出来看下好了,乱猜没有用的
那样比较明朗些.
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Function to calculate the number of days between two dates in oracle Function to calculate the number of days between two dates in oracle May 08, 2024 pm 07:45 PM

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

How long will Oracle database logs be kept? How long will Oracle database logs be kept? May 10, 2024 am 03:27 AM

How long will Oracle database logs be kept?

The order of the oracle database startup steps is The order of the oracle database startup steps is May 10, 2024 am 01:48 AM

The order of the oracle database startup steps is

How to use interval in oracle How to use interval in oracle May 08, 2024 pm 07:54 PM

How to use interval in oracle

How to see the number of occurrences of a certain character in Oracle How to see the number of occurrences of a certain character in Oracle May 09, 2024 pm 09:33 PM

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

How much memory does oracle require? How much memory does oracle require? May 10, 2024 am 04:12 AM

How much memory does oracle require?

Oracle database server hardware configuration requirements Oracle database server hardware configuration requirements May 10, 2024 am 04:00 AM

Oracle database server hardware configuration requirements

How to replace string in oracle How to replace string in oracle May 08, 2024 pm 07:24 PM

How to replace string in oracle

See all articles