25 7
MySQL 中有自增列,那如何获得插入语句生成的自增列 ID 呢?
在 MySQL 中用 last_insert_id() 函数;
在 PHP 中用 mysql_insert_id() 函数。
25 7
![]()
最近需要一个 online HTML text editor,搜了一下,找到了 FCKeditor,看了一下,原来 Intervals 用的就是他,一看他们的用户名单,不得了,Adobe、Oracle等等等等都在列啊。

功能不必多说了,肯定是超强了,支持 JAVA、PHP、ASP.NET、ASP等等,在PHP下使用也很简单:
1、下载解压到网站的一目录,如:/fckeditor/;
2、写以下的 PHP 代码:
<?php
include(’/fckeditor/fckeditor.php’);
$editor = new FCKeditor (’news_content’); // 参数为 FORM 要 POST 的 Name;
$editor->BasePath = ‘/fckeditor/’; // FCKeditor 的安装路径;
$editor->Value = ”; // 缺省值;
$editor->Width = ‘100%’;
$editor->Height = ‘500′;
$editor->Create();
?>
如此简单!
19 6
在特定的浏览器或特定的平台环境下,如果某文件以中文命名,有时在 Apache 下会出现类似以下的错误:forbidden you don’t have permission to access on this server.
遇到这种情况,只要对要请求的 URL 进行编码即可解决问题。

在 PHP 中,对中文 URL 用 urlencode() 函数编码后,虽然不会出现以上的错误,但却会出现“文件没有找到”这样的提示信息,这是为什么呢?
原因就在于 PHP 的 urlencode() 函数默认是使用本地编码来进行 encode 的,如 GB2312,而 Apache 默认是使用 UTF-8,生成的 URLEncode 不一致。只要转换一下编码即可,如下代码:
$url = urlencode(mb_convert_encoding($url, ‘UTF-8′, ‘GB2312′));
使用 mb_convert_encoding 函数需启用 PHP 的 mbstring (multi-byte string)扩展。