メソッドを使用して Kohana のビュー ファイルでリクエストをエコーしようとしていますが、コントローラでRequest::factory()取得できない値をそのリクエストで送信しています。コードは次のとおりです。User
ビュー ファイル:
<h1> Welcome to My First View File </h1>
<?php echo Request::factory("user",array("id" => 123))->execute(); ?>
次に、User.phpコントローラーには次のコードがあります。
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_User extends Controller {
public function action_index()
{
$value = $this->request->param('id');
$content = View::factory('menu')->bind("id", $value);
$this->response->body($content);
}
} // End User
ビューmenu.phpには次のコードがあります。
<h2> This is the view called by Request and Parameters send was:
<?php echo $id; ?>
</h2>
コードを実行すると、テキストThis is the view called by Request and Parameters send was:が表示されますが、表示されませ$idん。理由を教えてください。
PS: 私の母国語ではないので、英語が下手で申し訳ありません