×
新网 > 虚机资讯 > 正文

zend framework_v1 常见问题汇总

1、配置虚拟主机之后,Action无法正常工作,原因为没有开启AllowOverride。 初始配置:     DocumentRoot \"E:/PHP/votesystem001/public\"     ServerName zendvote.com     DirectoryIndex index.html index.htm

1、配置虚拟主机之后,Action无法正常工作,原因为没有开启AllowOverride。

timg.jpg

初始配置:

<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);

完成以上三步之后,你的中文乱码问题,也就解决了。

总结:目的就是要保证编码要统一。

 

  • 相关专题

免责声明:本文内容由互联网用户自发贡献自行上传,本网站不拥有所有权,也不承认相关法律责任。如果您发现本社区中有涉嫌抄袭的内容,请发送邮件至:operations@xinnet.com进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。

免费咨询获取折扣

Loading