Url Parameters To Function

Lets say i have a link to update as;

view:


<?php echo CHtml::link('Click me', array('site/Update','id'=>1); ?>

And controller actions:


public function actionUpdate(){

		$id =Yii::app()->request->getQuery('id');

		echo $id;

		or,

		$id = $this->getActionParams();

		echo $id['id'];

	}

[b]or[/b]

public function actionUpdate($id){

		echo $id;

	}

My question is what is the yii standard to get url parameters. As in second case, is it necessary to write $id to the actionUpdate ?

yes the second case is the yii standard and following this way yii will automatically send the id to you. and all you need to do is to just check the type of variable you are expecting ex(for integer) :


$id=(int) $id;