一、配置虛擬主機以後,Action沒法正常工做,緣由爲沒有開啓AllowOverride。 php
初始配置: html
<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> mysql
修改成: sql
<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> app
二、中文亂碼問題 ide
若是本網站的內容只是在國內公開,也就是說,只要支持中文便可,能夠經過下面的設置解決中文亂碼: 工具
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; url
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);
完成以上三步以後,你的中文亂碼問題,也就解決了。
總結:目的就是要保證編碼要統一。