独立配置APACHE+PHP 后出现的乱码问题.

CnPower 2005-09-16 09:50:30
APACHE1.3
PHP 4.3
-----------
现在的状况是
a.php
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<?
$fp = fopen ("shenyang.dat","rb");
$content = fgets($fp,1024);
echo $content;
?>
结果乱码
去掉 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
就正常.但是 echo "中文"会乱码
加上 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
从shenyang.dat 读出的文字全是乱码

我觉得是配置问题 php.ini 有一个需要加GB2312的地方我加了.
apache 搜索的时候都说要加一个 adddefaultcharset = gb2312 但是我的httpd.conf 里没那行
我自己加过 也没效果.

大家紧急帮忙阿 第一次配PHP/以前用 整套的安装 从来没这问题...:(
-----------
...全文
235 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
CnPower 2005-09-16
  • 打赏
  • 举报
回复
是unicode 的编码.
但我找不到合适的办法解决他.
iconv.dll 我明明从php.net 下载最新的 dll
但加载的时候就是会提示找不到指定的模块.
路径设置是没问题的。

结果现在搞的没办法.
mikespook 2005-09-16
  • 打赏
  • 举报
回复
shenyang.dat的编码是GB2312么?如果是BIG5或UTF-8编码,你这样读出来的肯定是乱码~~
CnPower 2005-09-16
  • 打赏
  • 举报
回复
上边的问题找到原因了.
是因为读取 .dat 的问题
把.dat 的内容复制到 x.txt 就正常了....
但是我必须要读 .dat 该怎么办?
haihaiff 2005-09-16
  • 打赏
  • 举报
回复
我是风风 我测试成功了!
<?php
echo iconv("ISO-8859-1", "latin1", "This is a test我爱PHP.");
?>
目录 第1篇 基础篇 第1章 开发环境 2 1.1 AppServ——PHP集成化安装包 3 实例001 通过AppServ配置PHP开发环境 3 实例002 AppServ应用技巧 6 实例003 第1个PHP程序 7 1.2 XAMPP——PHP集成化安装包 8 实例004 通过XAMPP配置PHP开发环境 8 实例005 测试XAMPP是否安装成功 11 实例006 XAMPP应用技巧 12 实例007 第2个PHP程序 13 1.3 IIS+PHP+MySQL——独立搭建PHP 开发环境 14 实例008 安装PHP 14 实例009 安装MySQL 15 实例010 安装IIS 21 实例011 第3个PHP程序 23 1.4 LAMP——独立配置PHP开发环境 24 实例012 安装Apache服务器 24 实例013 安装MySQL数据库服务器 26 实例014 安装PHP.50 28 实例015 第4个PHP程序 30 1.5 XAMPP——Linux版PHP集成化安装包 31 实例016 XAMPP——Linux下PHP开发环境的集成化 31 实例017 Linux操作系统下启动XAMPP 32 实例018 设置MySQL数据库root用户的密码 33 实例019 第5个PHP程序 34 1.6 Dreamweaver开发工具 35 实例020 Dreamweaver中编码格式的选择 35 实例021 Dreamweaver中创建表格 36 实例022 在表格中插入宠物照片 38 实例023 Dreamweaver创建表单 40 实例024 Dreamweaver中创建和附加CSS样式 42 实例025 Dreamweaver控制弹出信息 45 实例026 Dreamweaver控制浏览器的窗口 46 实例027 通过Dreamweaver创建站点 47 实例028 通过Dreamweaver开发第1个PHP程序 48 1.7 Zend Studio开发工具 50 实例029 安装Zend Studio 50 实例030 Zend Studio创建PHP项目 52 实例031 Zend Studio编码格式的转换 56 实例032 Zend Studio中快捷键的运用 57 实例033 Zend Studio中部署Apache服务器 60 第2章 PHP基础 63 2.1 基本语法 64 实例034 在页面中打印PHP配置信息 64 实例035 在页面中打印服务器时间 65 实例036 在页面中打印当前执行的PHP文件名 67 实例037 区分单引号和双引号 68 实例038 动态输出JavaScript代码 69 实例039 当数字遇到了字符串 70 实例040 PHP程序员的基础——变量的应用 72 实例041 打印系统环境变量信息print_r($_ENV) 73 实例042 使用可变变量输出“I Like PHP!” 73 实例043 使用转义字符输出特殊字符 74 实例044 使用常量指定PI的值计算圆的面积 75 2.2 运算符 75 实例045 自定义数字的加密/解密算法 76 实例046 比较两个时间戳的大小 77 实例047 使用条件运算符判断数字的奇偶性 78 实例048 判断用户是否具有后台管理权限 79 实例049 打印随机组合生日祝福语 80 实例050 打印2000~2020年的所有闰年 81 实例051 前置运算符和后置运算符的区别 82 实例052 使用位运算对数字进行加密和解密 83 2.3 包含语句 84 实例053 提高代码重用率 84 实例054 包含数据库连接文件 85 实例055 包含网站头文件 86 实例056 包含网站尾文件 87 实例057 包含网站的主文件 88 2.4 条件语句 89 实例058 员工生日提醒 89 实例059 考试成绩评定标准 90 实例060 控制登录用户权限 91 实例061 网页框架的制作 92 实例062 图片验证码 93 实例063 健康生活提醒 95 2.5 循环控制 96 实例064 员工生日列表 96 实例065 员工详细信息浏览 97 实例066 员工信息的批量删除 98 实例067 表格的动态创建 99 实例068 SESSION购物车中数据的读取 100 实例069 员工信息的管理 102 实例070 网页版九九乘法表 104 实例071 读取数组购物车中的数据 105 实例072 图像验证码的生成 106 2.6 跳转语句 107 实例073 控制页面中表情图的输出 107 实例074 控制页面中数据的输出数量 108 实例075 动态改变页面中单元格的背景颜色 109 实例076 屏蔽偶数次的数据输出 110 实例077 跳过数据输出中指定的记录 111 实例078 执行指定次数的循环 112 2.7 自定义函数 113 实例079 自定义函数截取中文字符串 113 实例080 公告标题的截取 114 实例081 论坛内容的简短输出 116 实例082 自定义函数过滤字符串 117 2.8 字符串 118 实例083 过滤论坛帖子中的空白和特殊字符 118 实例084 对论坛帖子的内容进行转义 119 实例085 还原论坛中帖子的内容 120 实例086 截取论坛标题 121 实例087 分割、合成字符串 121 实例088 查询关键字描红 122 实例089 统计查询关键字的出现次数 123 实例090 获取上传文件的后缀 124 实例091 统一上传文件名称的大小写 125 实例092 论坛中直接输出HTML脚本 126 实例093 统计帖子标题的长度 127 实例094 计算论坛帖子的字节数 128 实例095 实现帖子内容的定位查找 129 实例096 去除帖子标题的首尾空格 129 实例097 货币数据的格式化输出 130 实例098 日期、时间的格式化输出 131 实例099 比对论坛中帖子的相似度 132 实例100 对用户注册的密码进行加密和解密 132 实例101 保护URL地址中传递的参数 133 实例102 解析URL地址中传递的编码参数 134 实例103 转义帖子中的特殊字符 135 实例104 获取任意字符的ASCII码 136 实例105 查找指定ASCII码对应的字符 136 实例106 合理定义上传文件的名称 137 实例107 通过异或方式对用户注册密码进行加密 139 实例108 统一英文注册用户首字母的大小写 139 实例109 字符串与数字之间的转换 140 实例110 通过正则表达式对字符串进行匹配查找 141 实例111 通过IP地址查找主机所在地 142 实例112 解决用substr()函数对中文字符串截取时出现乱码问题 143 实例113 字符串与HTML标记相互转换 144 实例114 运用PHP 5.0新型字符串输出XML数据 145 实例115 判断字符串中是否存在指定子串 146 2.9 正则表达式 147 实例116 验证电话号码的格式是否正确 147 实例117 验证Email地址格式是否正确 148 实例118 验证IP地址是否有效 149 实例119 统计关键字的查询结果 150 实例120 计算查询操作的执行时间 151 实例121 查询关键字描红 152 实例122 判断上传文件的类型 153 实例123 判断邮政编码格式是否正确 154 2.10 数组 154 实例124 创建并输出数组 155 实例125 统计数组元素个数 156 实例126 向数组中添加元素 156 实例127 将数组中指定索引位置的元素替换 157 实例128 获取数组中最后一个元素 158 实例129 去除数组中的重复元素 158 实例130 字符串与数组的转换 159 实例131 对数组元素进行随机排序 160 实例132 随机抽取数组中元素 161 实例133 二维数组的输出 162 实例134 获取数组当前的键名和值 162 实例135 检测数组中是否存在某个值 163 实例136 获取数组中的当前单元 164 实例137 从数组中随机取出元素 165 实例138 合并数组 166 实例139 拆分数组 167 实例140 遍历数组 168 2.11 日期和时间 169 实例141 设置系统的当前时间 169 实例142 将日期和时间转换为时间戳 170 实例143 获取系统中的特定日期和时间 171 实例144 比较时间的大小 172 实例145 计算考试时间 173 实例146 倒计时 173 实例147 网页闹钟 174 实例148 计算程序运行时间 176 第3章 Web页面交互 178 3.1 获取表单元素的值 179 实例149 设计论坛登录界面 179 实例150 可以上传图片的表单 180 实例151 通过POST方法提交表单元素 182 实例152 通过$_POST方法获取表单元素 182 实例153 通过GET方法提交表单元素 184 实例154 通过$_GET方法获取表单元素 185 3.2 文本框组件的应用 186 实例155 以文本域的形式显示数据信息 186 实例156 限制多行文本域输入的字符个数 187 实例157 设置文本框的只读属性 188 实例158 自动计算金额 189 实例159 为文本框设置默认值 190 实例160 设置文本框的样式 191 实例161 文本域的滚动条 192 3.3 下拉列表的应用 193 实例162 省市级联动菜单 193 实例163 省市县级联动菜单 194 实例164 应用下拉列表选择所要联机的网站 196 实例165 可输入字符的下拉菜单 197 实例166 设置下拉列表的默认值 198 实例167 设置下拉列表的样式 199 实例168 下拉列表打开窗口 200 实例169 Tab键在文本域中的体现 201 3.4 表单元素的动态操作 203 实例170 投票系统中单选按钮与复选框的应用 203 实例171 选中单选按钮后显示其他表单元素 205 实例172 不提交表单获取单选按钮的值 207 实例173 实现复选框中的全选、反选和不选 208 实例174 隐藏域提交用户的ID值 210 实例175 图像域替代提交按钮 211 实例176 跳转菜单实现页面跳转 213 实例177 上传图片预览 214 实例178 去掉下拉选项的边框 215 实例179 修改表单属性为弹出窗口 216 实例180 表单输入单元的文字设置 217 实例181 表单输入单元单击删除 218 实例182 表单文本输入的移动选择 219 实例183 通过下拉列表选择头像 220 3.5 CSS+DIV页面布局 222 实例184 应用CSS+DIV实现无边框窗口 222 实例185 设置表格样式 224 实例186 设置图片的样式 225 实例187 滚动条样式 226 实例188 设置表单样式 227 实例189 设置超链接的样式 229 实例190 设置body的样式 230 实例191 模拟的进度条 231 实例192
中文名: WordPress 宝典 原名: WordPress Bible 别名: WordPress,Bible,宝典,PHP,CMS 作者: Aaron Brazell资源格式: PDF 出版社: Wiley书号: 978-0-470-56813-2发行时间: 2010年 地区: 美国 语言: 英文 简介:   WordPress 是一种使用 PHP 语言和 MySQL 数据库开发的开源、免费的 Blog(博客,网志)引擎,用户可以在支持 PHP 和 MySQL 数据库的服务器上建立自己的 Blog。   WordPress 是一个功能非常强大的博客系统,插件众多,易于扩充功能。安装和使用都非常方便。目前 WordPress 已经成为主流的 Blog 搭建平台。   WordPress 的原版是英文版的,UTF-8 编码,最新版本为 2.9。为满足日益庞大的中文用户需求开辟了中文官方站点且提供中文版程序下载。还有爱好者开发了中文语言包,使其可以支持中文。不过,由于使用的编码原因,中文字符截断时会出现乱码。不过桑葚网友制作的中文 WordPress 工具箱插件可以解决这个问题。   WordPress 可以说是世界上目前最先进的 weblog 程序。目前开发的程序大多都是根据它仿造的。它更能把握搜索引擎,在你使用 WordPress 并掌握几种插件后,对于优化将不用过多的操心,它会为你想的更多。   WordPress有许多第三方开发的免费模板,安装方式简单易用。不过要做一个自己的模板,则需要你有一定的专业知识。比如你至少要懂的HTML代码、CSS、PHP等相关知识。 Install WordPress and go beyond blogging WordPress is so flexible that developers are now tapping it to create robust applications for content, contact, and e-mail management. Whether you're a casual blogger or programming pro, this comprehensive guide covers WordPress from the basics through advanced application development. Learn how to use custom plugins and themes, retrieve data, maintain security, use social media, and modify your blog without changing any core code. You'll even get to know the ecosystem of products that surrounds this popular, open-source tool. Enhance your blog\'s findability in the search engines and beyond Discover hooks and leverage the WordPress event-driven programming interface Create WordPress widgets in only a few minutes Explore alternate uses of WordPress Enhance your blog with WordPress MU Ensure your plugins maintain future compatibility Create highly customizable and dynamic themes using template tags Learn best security practices as a user and developer Companion Web Site Visit www.wiley.com/go/wordpressbible for all of the author's example files from the book. Install, secure, and maintain WordPress Extend WordPress with plugins and themes Enhance your blog with WordPress MU 目录: Credits About the Author About the Technical Editor Contents Preface WordPress Versioning Getting the Most Out of This Book Using the Margin Icons Part I: Getting Started with WordPress Chapter 1: Learning About WordPress A Brief History of WordPress Leveraging the WordPress Community WordPress by the Numbers 10 Things You Need to Know About WordPress Understanding Open Source and the General Public License Summary Chapter 2: Installing and Configuring WordPress System Requirements Choosing a Web Server Installing WordPress Summary Chapter 3: WordPress, SEO, and Social Media Marketing Understanding the Basics of Search Engine Optimization Leveraging Social Networks to Extend Your Blog Summary Chapter 4: Finding Help in the WordPress Support System Using the WordPress Codex Staying in the Loop with Mailing Lists Finding Help in the WordPress Support Forums Summary Part II: Working with Plugins Chapter 5: Extending WordPress with Plugins Understanding WordPress Hooks Writing Your Own Plugin Extending the WordPress Admin Creating Events with Actions Modifying Content with Filters Using Multi-Argument Hooks Localizing Plugins Summary Chapter 6: Widgetizing WordPress Using Widgets in WordPress Building Widgets with the Widget API Widgetizing Your Theme Summary Chapter 7: Understanding the WordPress Database Class Examining the Schema and Properties of the Database Class Adding Data to MySQL with WordPress Retrieving Data from MySQL with WordPress Preventing SQL Injection Summary Chapter 8: Dissecting the Loop and WP_ Query Defining the Loop Wrangling the Loop with Plugins Developing Custom and Multiple Loops Using Loops Strategically Summary Part III: Working with Themes and Template Tags Chapter 9: Using Free or Premium Themes Understanding the User Experience Finding and Implementing Free Themes Finding and Implementing Premium Themes Summary Chapter 10: Understanding the Template File Hierarchy Looking at the Minimum Necessary Template Files Understanding the Common Template Files Enhancing the User Experience with Template Files Developing Custom Template Files Summary Chapter 11: Adding JavaScript and CSS to Themes Examining the jQuery and Prototype Frameworks Leveraging WordPress’ JavaScript Libraries Examining WordPress Plugins that Use JavaScript Effects Looking at Theme Styles Summary Chapter 12: Dissecting the Comment Loop, Template Tags, and Theme Best Practices Using Hooks in Themes Implementing Scripts in Themes Using Template Tags to Make Themes Dynamic Creating Conversations with Threaded Comments and Paged Comments Personalizing the Reader Experience with Avatars Summary Part IV: Creating Content Chapter 13: Navigating the Content Production Experience Customizing Your Workspace Leveraging the Elements of Content Creation Hacking Your Experience: Getting the Most Out of Writing Summary Chapter 14: Using Offline Editors What Is XML-RPC? Understanding XML-RPC Security Risks Looking at Offline Blog Editors Summary Part V: Keeping Up with the Joneses: Maintenance and Upgrades Chapter 15: Performing Automatic Upgrades Meeting the Minimum Automatic Upgrade Requirements Disabling the “Upgrade Nag” Performing Automatic Upgrades Using SSH for Automatic Upgrades Summary Chapter 16: Moving to WordPress and Backing It Up Moving a Blog to WordPress Importing Tags into WordPress Looking at Backup Routines Summary Chapter 17: WordPress Maintenance and Security Upgrading WordPress Choosing an FTP Client Practicing Sound WordPress Security Summary Chapter 18: Caching Strategy to Ensure WordPress Scales Understanding Caching Using WordPress Caching Mechanisms Optimizing PHP with Opcode Caching Caching MySQL with HyperDB and the Query Cache Harnessing the “Cloud” Summary Chapter 19: Understanding WordPress Roles and Capabilities Looking at WordPress Roles and Capabilities Using the Role Manager Plugin Summary Part VI: Alternate Uses for WordPress Chapter 20: Using WordPress for Alternative Blogging Photoblogging with WordPress Implementing a Twitter-style Blog Using Press This for a Tumble Blog Summary Chapter 21: WordPress as a Content Management System Using WordPress as a Content Management System Understanding Enterprise WordPress Needs Conveying a Consistent Message and Brand Understanding When a Blog Is Not a Blog Summary Part VII: Looking at the WordPress Ecosystem Chapter 22: Leveraging WordPress MU and Multi-Blog Functionality Installing and Configuring WordPress MU Converting a WordPress Blog to WordPress MU Understanding WordPress MU Plugin Nuances Adapting to WordPress MU Summary Chapter 23: Adding User Forums with bbPress Installing bbPress Finding bbPress Plugins Understanding the bbPress Theme System Summary Chapter 24: Creating Your Own Social Network with BuddyPress What Is BuddyPress? Configuring BuddyPress Comparing BuddyPress and WordPress Development Looking at BuddyPress Theme Concepts Extending BuddyPress Summary Chapter 25: Using BackPress as a Development Framework Defining BackPress Developing with BackPress Solving BackPress Dependencies Summary Chapter 26: WordPress.com and the Automattic Products About Automattic Taking a Look at Automattic’s Propriety Products Using WordPress.com Themes Getting Your Plugin Included in WordPress.com Buying Premium WordPress.com Features Summary Chapter 27: Leveraging Automattic Products Obtaining a WordPress.com API Key Using Akismet to Kill Spam Making Use of WordPress.com Stats Engaging Readers with IntenseDebate Crowdsourcing with PollDaddy Summary Part VIII: Appendixes Appendix A: WordPress Hook Reference Using Actions Using Filters Hook Reference: Alphabetical Listing Hook Reference: General Uses Summary Appendix B: Template Tags Understanding the Template Tag Concept Breaking Down the WordPress Templating System Summary Appendix C: What About PHP 5? PHP 4 versus PHP 5: Understanding Core Differences WordPress and PHP 5 Summary Appendix D: WordPress Hosting Features and Requirements of Web Hosts Types of Web Hosts Summary Appendix E: WordPress Vendors and Professional Services Top Consultants in the WordPress Community Directory of Automattic-Recommended Consultants Summary Appendix F: WordPress in Government WordPress Use in the Federal Government WordPress Use Outside the United States Summary Appendix G: WordPress in Major Media Newsroom Challenges for WordPress Roadmapping WordPress in Major Media Summary Appendix H: The General Public License Preamble GNU GENERAL PUBLIC LICENSE Index

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧