PHP开发框架 Yii 1.1.16 发布
我们很高兴地宣布 Yii Framework 版本 1.1.16 发布了。 您可以从 yiiframework.com/download/ 下载。
在此版本中,我们有包括了 120 多个改进和 bug 修复。对于这一版本中的完整更新列表,请参阅更新日志。
注意:此版本包含的变化,破坏向后的兼容性。请阅读升级说明了解如何升级。
We would like to express our gratitude to all contributors who have spent their precious time helping improve Yii and made this release possible.
Please note that Yii 1.1 is currently under maintenance mode, which means it will not introduce major new features in the future. We are currently actively developing and maintaining Yii 2.0 which represents a new generation of PHP framework utilizing the latest technologies. You may follow the development progress of Yii 2 by starring or watching Yii 2.0 GitHub Project. You may also follow Yii 推ter feeds or join Yii 非死book group to connect with other Yii developers.
下面我们将介绍一些此版本中主要的增强功能。
数据库和 ActiveRecord
Database support is evolving constantly in Yii. This time we've added official support for MariaDB and CUBRID databases.
ODBC 现在可以通过 pdo_odbc 连接像以下这样使用:
'components'=>array( ...... 'db'=>array( 'class'=>'CDbConnection' 'driverName'=>'mysql', 'connectionString'=>'odbc:Driver={MySQL};Server=127.0.0.1;Database=test', 'username'=>'', 'password'=>'', ), ),
当定义 STAT 关系时你可以使用 scopes:
public function scopes() { return array( 'recentPostCount'=>array(self::STAT,'Post','author_id','scopes'=>'recentScope'), ); }
One can specify post-JOIN operations (i.e. use|force|ignore index()) in relational queries like the following:
$users=User::model()->findAll(array( 'select'=>'t.id,t.name', 'with'=>array( 'posts'=>array( 'alias'=>'p', 'select'=>'p.id,p.title', 'joinOptions'=>'USE INDEX(post__user)', ), ), ));
It's described in detail in "Post-JOIN operations" section of "Relational Active Record" chapter of the guide.
CDbCommand::naturalLeftJoin() and CDbCommand::naturalRightJoin() were added to allow adding corresponding join statements to the command.
现在可以使用primarykey()重写方法模型 PK,即使表定义了一个。
文件
CFileHelper 有了新的方法:
createDirectory() - 创建目录递归权限设置。
getExtensionByMimeType() - 决定文件扩展名是基于MIME类型的。
Mime-Type detection itself was improved by using the mime.types file from Apache HTTP project.
CFileHelper::removeDirectory() now properly works with symlinked directories. It could be turned off by specifying traverseSymlinks as false in options array.
CFileHelper::findFiles() got new option named absolutePaths. Method returns absolute paths if the option is set to true or relative ones otherwise. Default value is true.
CFileCache got cachePathMode and cacheFileMode properties that could be used to chmod() these.
升级
我们框架使用的多个库已经更新:
jQuery to 1.11.1.
jQuery UI to 1.11.2.
Multifile plugin used by CMultiFileUpload to 1.48.
HTMLPurifier to 4.6.0.
i18n data bundled with the framework to CLDR23.1 http://cldr.unicode.org/index/downloads/cldr-23-1. This adds new locales and has many fixes and additional data for existing ones.
HTML5
When we've first released Yii 1.1 XHTML was the thing. Now it's HTML5 so we've decided to update default application template generated by yiic webapp to use HTML5.
CHtml and CActiveForm got support for HTML5 inputs such as color, datetime, datetime-local, week and search.
兼容性
各种第三方库工具和库经常与 Yii 使用的进行了更新,这样框架更新后就能支持这些。
CApcCache is now compatible with APCu.
Yii::import() and Yii::createComponent() are now able to use third party autoloader such as Composer.
Yii and YiiBase were added to composer.json autoloading.
PHPUnit 3.8+ now could be used.
请求
Request now properly reacts when there's X-HTTP-Method-Override header used to emulate various request types via POST.
There are getIsPatchRequest(), getIsPatchViaPostRequest() and getPatch() methods allowing you to work with HTTP PATCH requests.
框架现在请求时的响应是通过HTTP协议版本。
Request::getPreferredLanguage() is now able to select a best matching between supported and requested languages.
错误处理
错误处理有了一些改进。
You can now access exception object via ErrorHandler::getException(). It allows passing to various third party APIs efficiently.
Syslog log route is now available out of the box.
CClientScript now throws exception in case you're trying to register package that doesn't exist.
CActiveForm::$clientOptions got errorCallback so you can hook to clientside validation process using it.
其它
- Web services 增加了对 SOAP headers 和 document/literal 编码的支持。
- CJSON can now use JsonSerializable interface when serializing objects.
- CHtml::beginForm() now supports additional HTTP methods, via a hidden _method field.
- CPasswordHelper::generateSalt() now returns salt with $2y$ cost.
- CFormatter is now able to format DateTime instances.
Yii 是一个高性能的,适用于开发 WEB2.0 应用的 PHP 框架。
Yii 自带了丰富的功能 ,包括 MVC,DAO/ActiveRecord,I18N/L10N,缓存,身份验证和基于角色的访问控制,脚手架,测试等,可显著缩短开发时间。
快速
Yii 只加载您需要的功能。它具有强大的缓存支持。它明确的设计能与 AJAX 一起高效率的工作。
安全
Yii 的标准是安全的。它包括了输入验证,输出过滤,SQL 注入和跨站点脚本的预防。
专业
Yii 可帮助您开发清洁和可重用的代码。它遵循了 MVC 模式,确保了清晰分离逻辑层和表示层。来自:http://www.yiichina.com/news/77
</div>