不是很明白这里的东西,现在我要把一个由prado写成的代码转成Yii的代码,但是到了这边有用到CHttpRequest(我觉得是用到这个了)就不明白如何改了。下面这个是原来的prado代码。
public function onInit($param) {
parent::onInit($param);
$hostip = $this->Request->getUserHostAddress();
$hostname = gethostbyaddr($hostip);
CApp::log('recieved request from : '. $hostname);
$status = $this->Request['status'];
$msg = $this->Request['msg'];
$this->Response->write('ok');//这个是什么意思?如何写作Yii?
......
我现在想把这段代码改成用Yii写的,而且想写在controller里,我看了一下这个,是不是要用到CHttpRequest?
比如这个: $hostip = $this->Request->getUserHostAddress();
$hostname = gethostbyaddr($hostip);
可以改为:
$hostname = CHttpRequest::getUserHost();
这样对吗?
还有 $status = $this->Request[‘status’];
$msg = $this->Request['msg'];
这个是什么意思?也是别人发给我的请求中的数据吗?用Yii的话如何获取呢?
多谢!!!