浏览模式: 标准 | 列表分类:PHP Framework
Submitted by gouki on 2013, January 15, 11:54 AM
一转眼,thinkphp已经走过了7个年头,这在开源软件里也算是一个很长的年头了。
7年,结婚是7年之痒,thinkphp从最初的fcs走到现在,中间经历的坎坷自是不必说了。
创业是一件很艰辛的事情,流年坚持将公司办在上海,就是为了能够使得用户产生很大的信任感。如今,这份信任也确实得到了回报。
看看ThinkPHP七周年页面所说的:
http://www.thinkphp.cn/7year.html
- 七年来,ThinkPHP专注于WEB应用快速开发。
- 七年来,ThinkPHP超过了300W次下载。
- 七年来,ThinkPHP经历了7个里程碑版本。
- 七年来,ThinkPHP为50W个网站提供了底层框架。
先不管有没有水份,至少现在有不少公司的招聘里,已经有公司将熟悉ThinkPHP框架当成了条件之一。这也能够证明上面的内容的真实性和可靠性了。
所以我还是坚持那句话:时间能够证明一切。
Tags: thinkphp
PHP Framework | 评论:1
| 阅读:20198
Submitted by gouki on 2012, May 30, 5:32 PM
Yii在使用CHtmlRadio的时候,如果参数不正确,会隐藏一个form,导致如果radio的值有3个时,永远只能提交第一个和最后一个
太纠结了。仔细看看,确实 是有一个隐藏FORM,导致本来应该是3个radio的button,变成了6个。
找了一下资料,看了一下源码,果然。。。。有一个hidden。
PHP代码
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public static function activeRadioButton($model,$attribute,$htmlOptions=array())
- {
- self::resolveNameID($model,$attribute,$htmlOptions);
- if(!isset($htmlOptions['value']))
- $htmlOptions['value']=1;
- if(!isset($htmlOptions['checked']) && self::resolveValue($model,$attribute)==$htmlOptions['value'])
- $htmlOptions['checked']='checked';
- self::clientChange('click',$htmlOptions);
-
- if(array_key_exists('uncheckValue',$htmlOptions))
- {
- $uncheck=$htmlOptions['uncheckValue'];
- unset($htmlOptions['uncheckValue']);
- }
- else
- $uncheck='0';
-
- $hiddenOptions=isset($htmlOptions['id']) ? array('id'=>self::ID_PREFIX.$htmlOptions['id']) : array('id'=>false);
- $hidden=$uncheck!==null ? self::hiddenField($htmlOptions['name'],$uncheck,$hiddenOptions) : '';
-
- // add a hidden field so that if the radio button is not selected, it still submits a value
- return $hidden . self::activeInputField('radio',$model,$attribute,$htmlOptions);
- }
太纠结了。居然用unCheckValue设置一下才OK:
PHP代码
- echo CHtml::radioButton('btn', false, array(
- 'value'=>'1',
- 'name'=>'btnname',
- 'uncheckValue'=>null
- ));
- CHtml::radioButton('btn', false, array(
- 'value'=>'2',
- 'name'=>'btnname',
- 'uncheckValue'=>null
- ));
-
-
- echo $form->radioButton($model, 'name', array(
- 'value'=>1,
- 'uncheckValue'=>null
- ));
- echo $form->radioButton($model, 'name', array(
- 'value'=>2,
- 'uncheckValue'=>null
- ));
果然纠结。。。NND
Tags: yii
PHP Framework | 评论:0
| 阅读:21086
Submitted by gouki on 2012, May 28, 10:51 PM
Zend 2.0的框架改动与1比实在是太大了,当然抛开Namespace不说,即使是应用和架构,都有了一部分调整。
Zend实在太庞大了。用来开发项目不一定是首选。以前都是当成类库来用的,毕竟他实现了几乎目前所需要用到的一切功能,甚至GData之类的接口都全了,你还能奢求什么?
要赶时髦?openID和oauth也有,要实用?连pdf库都有,发邮件、本地化、命令行,应有尽有,不是类库是什么?
不过2.0就不太一样。我随便看了一个DB类,和以前的操作都有点不太一样了。或许是一下子没有适应过来那种newZend_Db_TableGateway之类的调用方式吧
手册在这里:http://packages.zendframework.com/docs/latest/manual/en
下载在这里:http://packages.zendframework.com/
还有一个相对比较实用的wiki:http://framework.zend.com/wiki/display/ZFDEV2/Home
可以看看。2.0的架构和代码还是值得学习的。
Tags: zend, yii
PHP Framework | 评论:0
| 阅读:18639
Submitted by gouki on 2012, April 16, 8:54 AM
1、yii在linux下面连接mssql时,connectString一般是dblib:xxxxx,而不是mssql,这是因为用freetds的原因
2、用gii生成mssql的数据表结构时,如果表的字段是类似"Post Time"(即,字段中间有空格),则直接会报错
3、当生成好Model时,使用xxx::model()->findAll()时,如果最初的表结构里有允许某个字段为空,即允许isnull的话,在数据库中,该字段无值时是NULL,findAll就会报错:
XML/HTML代码
- CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 4004 General SQL Server error: Check messages from the SQL Server [4004] (severity 16) [(null)]. The SQL statement executed was: SELECT TOP 1 * FROM [dbo].[DatabaseLog] [t]
4、无论是mysql还是sqlserver,当在components中设置columnCase值的时候,都会报错,这是因为在 MysqlSchema中都是采用了大小写敏感的方式(如$column['IsIdenfy'])之类的,当大小写敏感后,如果在attributes 中设置了PDO的ATTR_CASE,都会报错
Tags: yii, mssql
PHP Framework | 评论:0
| 阅读:20625
Submitted by gouki on 2012, April 14, 8:37 PM
yii的urlmanager可以让项目在访问的时候隐藏index.php,也可以以更优雅的urlrewrite方式来显示,但这一切需要一些配置,在apache上的配置上就相对比较简单,直接参考wordpress的官方配置就完了,但其实很久以来,一直都没有人写过nginx下的配置。大家都是在根据wordpress配置来更改的,比如lnmp项目中,就是:
XML/HTML代码
- location / {
- if (-f $request_filename/index.html){
- rewrite (.*) $1/index.html break;
- }
- if (-f $request_filename/index.php){
- rewrite (.*) $1/index.php;
- }
- if (!-f $request_filename){
- rewrite (.*) /index.php;
- }
- }
不过,这两天在看官方guide的文档,原来这些问题,官方已经提供方案了:http://yii.neatcn.com/doc/guide/1.1/en/quickstart.apache-nginx-config#nginx
1. Apache
Yii is ready to work with a default Apache web server configuration. The .htaccess files in Yii framework and application folders restrict access to the restricted resources. To hide the bootstrap file (usually index.php) in your URLs you can add mod_rewrite instructons to the .htaccess file in your document root or to the virtual host configuration:
XML/HTML代码
- RewriteEngine on
-
- # if a directory or a file exists, use it directly
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteCond %{REQUEST_FILENAME} !-d
- # otherwise forward it to index.php
- RewriteRule . index.php
2. Nginx
You can use Yii with Nginx and PHP with FPM SAPI. Here is a sample host configuration. It defines the bootstrap file and makes yii catch all requests to unexisting files, which allows us to have nice-looking URLs.
XML/HTML代码
- server {
- set $host_path "/www/mysite";
- access_log /www/mysite/log/access.log main;
-
- server_name mysite;
- root $host_path/htdocs;
- set $yii_bootstrap "index.php";
-
- charset utf-8;
-
- location / {
- index index.html $yii_bootstrap;
- try_files $uri $uri/ $yii_bootstrap?$args;
- }
-
- location ~ ^/(protected|framework|themes/\w+/views) {
- deny all;
- }
-
- #avoid processing of calls to unexisting static files by yii
- location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
- try_files $uri =404;
- }
-
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- location ~ \.php {
- fastcgi_split_path_info ^(.+\.php)(.*)$;
-
- #let yii catch the calls to unexising PHP files
- set $fsn /$yii_bootstrap;
- if (-f $document_root$fastcgi_script_name){
- set $fsn $fastcgi_script_name;
- }
-
- fastcgi_pass 127.0.0.1:9000;
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root$fsn;
-
- #PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
- fastcgi_param PATH_INFO $fastcgi_path_info;
- fastcgi_param PATH_TRANSLATED $document_root$fsn;
- }
-
- location ~ /\.ht {
- deny all;
- }
- }
Using this configuration you can set cgi.fix_pathinfo=0 in php.ini to avoid many unnesessary system stat() calls.
Tags: yii, apache, nginx, wordpress, urlrewrite
PHP Framework | 评论:0
| 阅读:24085