Zend_Http_Client 中的远程地址参数
正在开发一个使用 Zend_Http_Client 访问远程逻辑的公共站点。客户端适配器中是否有属性/方式可以设置浏览该站点的用户的远程地址?
目前正在使用这种结合了远程地址和远程用户代理的解决方法。
$client = new Zend_Http_Client();
$client->setConfig(array(
'useragent' => 'Get Remote Address'.'Get User Agent',
));
远程地址有特定的属性吗?
Am developing a public site that uses the Zend_Http_Client to access remote logic.Is there a property/way in the Client adapter that I could set the remote address of the user browsing the site?
Currently am using this workaround which combines both remote address and remote useragent.
$client = new Zend_Http_Client();
$client->setConfig(array(
'useragent' => 'Get Remote Address'.'Get User Agent',
));
Is there a specific property for remote address?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从任何 Zend_Controller_Action 方法中,您可以检索用户的远程地址,如下所示:
如果您不在控制器中,则可以使用以下假设使用了前端控制器:
最后 - 这些方法只是 SERVER 超全局的包装器:
替换 REMOTE_ADDR使用 HTTP_USER_AGENT 来获取用户代理。
From any Zend_Controller_Action method you can retrieve the user's remote address as follows:
If you're not in a Controller, you can use the following assuming the Front Controller was used:
And finally - these methods are just wrappers for the SERVER superglobal:
Substitute REMOTE_ADDR with HTTP_USER_AGENT to get the user agent.