我正在尝试从返回的kayako票证对象访问私有财产,反射似乎是这样做的方式。在这里,我尝试了似乎是正确的方法,但我没有得到任何回报,因为它是私人的,我不能这是获得房产价值的正常简单方法。请协助。
/* no output */
public function load_ticket($id) {
$content = kyTicket::get($id);
$reflect = new ReflectionClass($content);
$posts = $reflect->getProperty('posts');
$posts->setAccessible(true);
print_r($posts->getValue(new kyTicket));
/* fatal error - see below */
public function load_ticket($id) {
$content = kyTicket::get($id);
$reflect = new ReflectionClass($content);
$posts = $reflect->getProperty('posts')->getValue();
print_r($posts);
[29-Sep-2014 17:32:13] PHP致命错误:未捕获异常' ReflectionException'有消息'无法访问非公开成员kyTicket :: posts'在/var/www/html/site/public_html/inc/QA/External/kayako.class.php:49
请指出正确的方向或让我知道如何从以下方面获取以下信息:
kyTicket Object
(
[id:protected] => 6
[flag_type:protected] => 5
[display_id:protected] => 1234
[department_id:protected] => 3
[status_id:protected] => 3
[priority_id:protected] => 6
[type_id:protected] => 1
[user_id:protected] => 202
[user_organization_name:protected] =>
[posts:kyTicket:private] => Array
(
[0] => kyTicketPost Object
(
[id:protected] => 6
[ticket_id:protected] => 6
[dateline:protected] => 1407409550
[user_id:protected] => 202
[full_name:protected] => Agent
[email:protected] => email@gmail.com
[email_to:protected] =>
[ip_address:protected] => 1.2.3.4
[has_attachments:protected] =>
[creator:protected] => 2
[is_third_party:protected] =>
[is_html:protected] =>
[is_emailed:protected] =>
[staff_id:protected] =>
[is_survey_comment:protected] =>
[contents:protected] => Chat ID: 1234
email contents here
我正在尝试获取帖子 - > [0] - >内容
再次感谢!