1、配置虚拟主机之后,Action无法正常工作,原因为没有开启AllowOverride。
初始配置:
<VirtualHost 127.0.0.1:80>
DocumentRoot "E:/PHP/votesystem001/public" ServerName zendvote.com DirectoryIndex index.html index.htm index.php <Directory /> Options FollowSymLinks #不允许别人修改我们的页面 AllowOverride None #设置访问权限 order allow,deny Allow from all </Directory> </VirtualHost>修改为:
<VirtualHost 127.0.0.1:80>
DocumentRoot "E:/PHP/votesystem001/public" ServerName zendvote.com DirectoryIndex index.html index.htm index.php <Directory /> Options FollowSymLinks #不允许别人修改我们的页面 AllowOverride All #设置访问权限 order allow,deny Allow from all </Directory> </VirtualHost>2、中文乱码问题
如果本网站的内容只是在国内公开,也就是说,只要支持中文即可,可以通过下面的设置解决中文乱码:
1>在mysql创建表的时候,写明编码为gbk;
CREATE TABLE `vote_log` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `ip` varchar(20) NOT NULL, `vote_date` bigint(20) NOT NULL, `item_id` bigint(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=gbk;2>所用的代码编辑工具,设置编码为GBK;
3>初始化适配器的时候,指明为GBK;
$url = constant("APPLICATION_PATH").DIRECTORY_SEPARATOR.'configs'.DIRECTORY_SEPARATOR.'application.ini';
$dbconfig = new Zend_Config_Ini($url,"mysql $db = Zend_Db::factory($dbconfig->db); $db->query('SET NAMES GBK'); Zend_Db_Table::setDefaultAdapter($db);完成以上三步之后,你的中文乱码问题,也就解决了。
总结:目的就是要保证编码要统一。