In Yii You Can Access The $_Request , $_Post , $_Get Variables Directly Or Use The Getparam.


In Yii you can access the $_REQUEST , $_POST , $_GET variables directly or use the getParam.

I understand that getParam really does is use those arrays directly anyway, but with the difference that if the param doesn’t exist it returns null by default, or a value that you specify as the second argument to the getParam call.

My question is that in many wiki articles, forum posts, Yii books, and articles available on the net, the example code does not make use of the getParam method, but instead uses the $_REQUEST , $_POST , $_GET to

access the variables.

Is there times when you should not use the getParam, and if so, what are they.



It really just boils down to personal preference. I like getQuery/Post/Param for the default value facility and the way it looks in my code.