网站设计

设置Yii时区和数据库时区

Column types
Change all date, time, datetime columns to timestamp. This is because timestamp fields are converted and stored as UTC They can also accept values such as ‘ 2011-05-25T01:42:48+1000′. You can also then use ’set time_zone’ in phpmyadmin to display timestamp fields in your local time zone.
Config
In protected/config/main.php make [...]


Yii设置和获取config参数

Yii参数配置文件保存在protect/config/main.php中,如果你想保存一些自己的设置参数,比如domain,SMTP参数的话可以在该文件中设置,如果想获取的话,使用下面代码:
Yii::app()->params['adminEmail'],
这样讲获得管理员的邮件地址。其他参数以此类推。


PHP Get 方法加号处理

用 get 方法 , 参数里有 “+” 时,要做处理,否则到后台会变成空格

解决方案:

1 、改用 post 方法 ,ok

2 、在 js 里用 url = encodeURI(encodeURI(XXX))

3 、将参数里的加号进行转换 data = data.replace(/\+/g, “%2B”);
(2,3步可以合为一步 encodeURIComponent(encodeURIComponent(xxxx)) )

4、 PHP接受使用 rawurldecode后台再解码一次, ok