2009年5月14日星期四
PHP的字符集问题
< html>
< title >页面标题< /title >
< meta equiv="Content-Type" content="text/html; charset=gb2312" >
......
这种方法在FF上还是有问题,在IE上是可以的。
第二种方法
< ?php
header("Content-Type:text/html;charset=GB2312");
? >
这种方法在FF上也正常显示,在IE上是可以的。
现在的问题是,如果我页面是UTF-8的编码,而且PHP是默认用UTF-8,但是我的数据源使用GB2312的时候,页面无论如何都会出现乱码。这个问题应该怎么解决,方法还没查到。
2009年5月12日星期二
配置EMACS的PHP模式
从http://sourceforge.net/projects/php-mode/
下载php-mode.el
http://www.emacswiki.org/cgi-bin/wiki/HtmlModeDeluxe
有在同文件里混合代码的处理说明需要mmm支持
在.emacs中加入
;;---------- php
(add-to-list 'load-path (expand-file-name "/usr/local/share/emacs/22.2/site-lisp"))
(require 'php-mode)
;;---------- mmm-mode
(add-to-list 'load-path (expand-file-name "/usr/local/share/emacs/22.2/site-lisp/mmm-mode"))
(add-hook 'php-mode-user-hook 'turn-on-font-lock)
(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class nil "\\.php3?\\'" 'html-php)
(mmm-add-classes
'((html-php
:submode php-mode
:front "<\\?\\(php\\)?" :back "\\?>")))
(set-face-background
'mmm-default-submode-face "Blank")
(autoload 'php-mode "php-mode" "PHP editing mode" t)
(add-to-list 'auto-mode-alist '("\\.php3?\\'" . html-mode))
至于怎么在linux平台下的emacs中调试和运行php,有待继续研究。
emacs wiki里给的那个配置文件是有问题的,今天查了一天才搞定。

