简体   繁体   English

如何在Zend Framework和PHP中访问[_host:protected]

[英]How to access [_host:protected] in Zend Framework and PHP

Using Zend amazon service, I have fetched till there. 使用Zend amazon服务,我已经到了那里。

$url=$result->LargeImage->Url;
print_r($url);

the output of this is: 这个输出是:

Zend_Uri_Http Object
(
    [_username:protected] => 
    [_password:protected] => 
    [_host:protected] => ecx.images-amazon.com
    [_port:protected] => 
    [_path:protected] => /images/I/41voDxJS62L.jpg
    [_query:protected] => 
    [_fragment:protected] => 
    [_regex:protected] => Array
        (
            [escaped] => %[[:xdigit:]]{2}
            [unreserved] => [A-Za-z0-9-_.!~*'()\[\]]
            [segment] => (?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\]:@&=+$,;])*
            [path] => (?:\/(?:(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\]:@&=+$,;])*)?)+
            [uric] => (?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\];\/?:@&=+$,])
        )

    [_scheme:protected] => http
)

We can't do echo $url->_host:protected here as 'protected' is keyword. 我们不能做echo $ url - > _ host:protected here,因为'protected'是关键字。

How do I access that? 我该如何访问? Can anyone help please? 有人可以帮忙吗?

Thanks 谢谢

Use the getter. 使用吸气剂。

$result->LargeImage->Url->getHost()

or 要么

$url->getHost()

See the documentation : http://framework.zend.com/apidoc/1.9/Zend_Uri/Zend_Uri_Http.html 请参阅文档: http//framework.zend.com/apidoc/1.9/Zend_Uri/Zend_Uri_Http.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM