mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
docs/guide-ja updated [ci skip]
This commit is contained in:
@ -289,7 +289,7 @@ Yii のリリースに含まれている [コアバリデータ](tutorial-core-v
|
||||
```php
|
||||
/**
|
||||
* @param string $attribute 現在検証されている属性
|
||||
* @param array $params 規則に与えられる追加の「名前-値」のペア
|
||||
* @param mixed $params 規則に与えられる "params" の値
|
||||
*/
|
||||
function ($attribute, $params)
|
||||
```
|
||||
|
@ -315,26 +315,26 @@ URL 規則は、パターンの中で `<ParamName:RgExp>` の形式で指定さ
|
||||
|
||||
```php
|
||||
[
|
||||
'posts/<year:\d{4}>/<category>' => 'post/index',
|
||||
'posts' => 'post/index',
|
||||
'post/<id:\d+>' => 'post/view',
|
||||
'posts/<year:\d{4}>/<category>' => 'post/index',
|
||||
]
|
||||
```
|
||||
|
||||
規則が URL 解析に使われる場合は、
|
||||
|
||||
- `/index.php/posts` は、最初の規則を使って解析され、ルート `post/index` になります。
|
||||
- `/index.php/posts/2014/php` は、三番目の規則を使って解析され、ルートは `post/index`、`year` パラメータの値は 2014、そして、`category` パラメータの値は `php` となります。
|
||||
- `/index.php/post/100` は、二番目の規則を使って解析され、ルートが `post/view`、`id` パラメータの値が 100 となります。
|
||||
- `/index.php/posts` は、二番目の規則を使って解析され、ルート `post/index` になります。
|
||||
- `/index.php/posts/2014/php` は、最初の規則を使って解析され、ルートは `post/index`、`year` パラメータの値は 2014、そして、`category` パラメータの値は `php` となります。
|
||||
- `/index.php/post/100` は、三番目の規則を使って解析され、ルートが `post/view`、`id` パラメータの値が 100 となります。
|
||||
- `/index.php/posts/php` は、どのパターンにも合致しないため、[[yii\web\UrlManager::enableStrictParsing]] が true の場合は、[[yii\web\NotFoundHttpException]] を引き起こします。
|
||||
[[yii\web\UrlManager::enableStrictParsing]] が false (これが既定値です) の場合は、パス情報の部分である `posts/php` がルートとして返されることになります。
|
||||
|
||||
規則が URL 生成に使われる場合は、
|
||||
|
||||
- `Url::to(['post/index'])` は、最初の規則を使って、`/index.php/posts` を生成します。
|
||||
- `Url::to(['post/index', 'year' => 2014, 'category' => 'php'])` は、三番目の規則を使って、`/index.php/posts/2014/php` を生成します。
|
||||
- `Url::to(['post/view', 'id' => 100])` は、二番目の規則を使って、`/index.php/post/100` を生成します。
|
||||
- `Url::to(['post/view', 'id' => 100, 'source' => 'ad'])` も、二番目の規則を使って、`/index.php/post/100?source=ad` を生成します。
|
||||
- `Url::to(['post/index'])` は、二番目の規則を使って、`/index.php/posts` を生成します。
|
||||
- `Url::to(['post/index', 'year' => 2014, 'category' => 'php'])` は、最初の規則を使って、`/index.php/posts/2014/php` を生成します。
|
||||
- `Url::to(['post/view', 'id' => 100])` は、三番目の規則を使って、`/index.php/post/100` を生成します。
|
||||
- `Url::to(['post/view', 'id' => 100, 'source' => 'ad'])` も、三番目の規則を使って、`/index.php/post/100?source=ad` を生成します。
|
||||
`source` パラメータは規則の中で指定されていないので、クエリパラメータとして、生成される URL に追加されます。
|
||||
- `Url::to(['post/index', 'category' => 'php'])` は、どの規則も使わずに、`/index.php/post/index?category=php` を生成します。
|
||||
どの規則も当てはまらないため、URL は、単純に、ルートをパス情報とし、すべてのパラメータをクエリ文字列として追加して生成されます。
|
||||
|
@ -36,7 +36,7 @@ Composer は `composer self-update` コマンドを実行してアップデー
|
||||
|
||||
Composer がインストールされたら、ウェブからアクセスできるフォルダで下記のコマンドを実行することによって Yii をインストールすることが出来ます。
|
||||
|
||||
composer global require "fxp/composer-asset-plugin:1.0.0-beta4"
|
||||
composer global require "fxp/composer-asset-plugin:1.0.0"
|
||||
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
|
||||
|
||||
最初のコマンドは [composer アセットプラグイン](https://github.com/francoispluchino/composer-asset-plugin/) をインストールします。
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
Composer がインストールされていれば、次のコマンドを使ってアプリケーションをインストールすることが出来ます。
|
||||
|
||||
composer global require "fxp/composer-asset-plugin:1.0.0-beta4"
|
||||
composer global require "fxp/composer-asset-plugin:1.0.0"
|
||||
composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application
|
||||
|
||||
最初のコマンドは [composer asset plugin](https://github.com/francoispluchino/composer-asset-plugin/) をインストールします。
|
||||
|
@ -54,6 +54,6 @@ Yii の新しいアプリケーションテンプレートを作成するのに
|
||||
これで、あなたのテンプレートを使ってプロジェクトを作成することが出来ます。
|
||||
|
||||
```
|
||||
composer global require "fxp/composer-asset-plugin:1.0.0-beta4"
|
||||
composer global require "fxp/composer-asset-plugin:1.0.0"
|
||||
composer create-project --prefer-dist --stability=dev mysoft/yii2-app-coolone new-project
|
||||
```
|
||||
|
@ -77,8 +77,8 @@ Yii は数多くの優れた機能を提供していますので、サードパ
|
||||
|
||||
サードパーティのシステムが Composer を使って依存を管理している場合は、単に下記のコマンドを実行すれば Yii をインストールすることが出来ます。
|
||||
|
||||
composer global require "fxp/composer-asset-plugin:1.0.0-beta4"
|
||||
composer require "yiisoft/yii2:*"
|
||||
composer global require "fxp/composer-asset-plugin:1.0.0"
|
||||
composer require yiisoft/yii2
|
||||
composer install
|
||||
|
||||
最初のコマンドは [composer アセットプラグイン](https://github.com/francoispluchino/composer-asset-plugin/) をインストールします。
|
||||
|
Reference in New Issue
Block a user