PHP開發框架 Yii 1.1.16 發布

jopen 9年前發布 | 21K 次閱讀 Yii

我們很高興地宣布 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 一起高效率的工作。

            <div class="col-lg-4">
                <h2 class="secure"> 安全</h2>
                <p>Yii 的標準是安全的。它包括了輸入驗證,輸出過濾,SQL 注入和跨站點腳本的預防。</p>
            </div>

                <h2 class="professional"> 專業</h2>
                Yii 可幫助您開發清潔和可重用的代碼。它遵循了 MVC 模式,確保了清晰分離邏輯層和表示層。<br />


來自:http://www.yiichina.com/news/77

</div>

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!