我目前有一个名为$Listings
的变量,它在var_dump($Listing);
时输出:
object(xreceiver_listing)#15 (11) {
["table":protected]=> string(24) "perch_xreceiver_listings"
["pk":protected]=> string(5) "XMLID"
["api":protected]=> object(PerchAPI)#10 (3) {
["app_id"]=> string(13) "tfd_xreceiver"
["version"]=> float(1)
["Lang":"PerchAPI":private]=> object(PerchAPI_Lang)#11 (5) {
["lang_dir"]=> string(106) "/var/www/vhosts/thirdfloordigital.net/development.thirdfloordigital.net/cms/addons/apps/tfd_xreceiver/lang"
["lang_file"]=> string(116) "/var/www/vhosts/thirdfloordigital.net/development.thirdfloordigital.net/cms/addons/apps/tfd_xreceiver/lang/en-gb.txt"
["lang"]=> string(5) "en-gb"
["translations":"PerchAPI_Lang":private]=> array(31) {
["lang"]=> string(5) "en-gb"
["Sample"]=> string(6) "Sample"
["Sample app"]=> string(10) "Sample app"
["There are currently no things. Why not add one?"]=> string(47) "There are currently no things. Why not add one?"
["In the sidebar you should try and give the user guidance and tips."]=> string(66) "In the sidebar you should try and give the user guidance and tips."
["For content editing pages, presume the user is non-technical editor using the software."]=> string(87) "For content editing pages, presume the user is non-technical editor using the software."
["For configuration pages, presume the user is the web designer who is setting up the site."]=> string(89) "For configuration pages, presume the user is the web designer who is setting up the site."
["Add/Edit"]=> string(8) "Add/Edit"
["Add Thing"]=> string(9) "Add Thing"
["Listing all Sample Things"]=> string(25) "Listing all Sample Things"
["Edit"]=> string(4) "Edit"
["Thing / Create New Thing"]=> string(24) "Thing / Create New Thing"
["Thing details"]=> string(13) "Thing details"
["Title"]=> string(5) "Title"
["Date"]=> string(4) "Date"
["Save"]=> string(4) "Save"
["or"]=> string(2) "or"
["Cancel"]=> string(6) "Cancel"
["Your thing has been successfully created. Return to %sthing listing%s"]=> string(69) "Your thing has been successfully created. Return to %sthing listing%s"
["Thing / Edit Thing"]=> string(18) "Thing / Edit Thing"
["All"]=> string(3) "All"
["Delete"]=> string(6) "Delete"
["Delete Thing"]=> string(12) "Delete Thing"
["Delete a thing here."]=> string(20) "Delete a thing here."
["Deleting a Thing"]=> string(16) "Deleting a Thing"
["Are you sure you wish to delete the thing %s?"]=> string(45) "Are you sure you wish to delete the thing%s?"
["Example setting"]=> string(15) "Example setting"
["XReceiver"]=> string(9) "XReceiver"
["There are currently no listings. Why not add one?"]=> string(49) "There are currently no listings. Why not add one?"
["Add Listing"]=> string(11) "Add Listing"
["All Listings"]=> string(12) "All Listings"
}
["to_add":"PerchAPI_Lang":private]=> array(0) {
}
}
}
["db":protected]=> object(PerchDB_MySQL)#3 (4) {
["link":"PerchDB_MySQL":private]=> object(PDO)#5 (0) {
}
["errored"]=> bool(false)
["error_msg"]=> bool(false)
["dsn"]=> string(43) "mysql:host=localhost;dbname=developmenttfd;"
}
["details":protected]=> array(28) {
["XMLID"]=> string(1) "5"
["command"]=> string(3) "add"
["username"]=> string(8) "jimgreen"
["password"]=> string(8) "p455w0rd"
["contact_name"]=> string(11) "Sean Greeen"
["contact_email"]=> string(13) "jim@green.com"
["contact_telephone"]=> string(12) "066 3413 930"
["contact_url"]=> string(13) "www.green.com"
["days_to_advertise"]=> string(2) " 7"
["application_email"]=> string(32) "jim.12345.123@green.aplitrak.com"
["application_url"]=> string(39) "http://www.url.com/ad.asp?adid=12345123"
["job_reference"]=> string(6) "abc123"
["job_title"]=> string(13) "Web Developer"
["job_type"]=> string(9) "Permanent"
["job_id"]=> string(14) "abc123_1234567"
["job_duration"]=> string(9) "Permanent"
["job_startdate"]=> string(4) "ASAP"
["job_skills"]=> string(19) "VB, C++, PERL, Java"
["job_description"]=> string(32) "This is the detailed description"
["job_location"]=> string(6) "London"
["job_industry"]=> string(9) "Aerospace"
["salary_currency"]=> string(3) "gbp"
["salary_from"]=> string(5) "30000"
["salary_to"]=> string(5) "33000"
["salary_per"]=> string(5) "annum"
["salary_benefits"]=> string(17) "Bonus and Pension"
["salary"]=> string(51) "£30000 - £33000 per annum + Bonus and Pension"
["listingDynamicFields"]=> NULL
}
["index_table":protected]=> bool(false)
["event_prefix":protected]=> bool(false)
["suppress_events"]=> bool(true)
["can_log_resources":protected]=> bool(true)
["modified_date_column":protected]=> bool(false)
["pk_is_int":protected]=> bool(true)
}
我需要访问details:protected
数组并从那里获取信息。
到目前为止,我已经尝试过了:
`$variable = $classAccess->{'PerchAPI'};var_dump($variable);`
返回NULL
。
有关访问此阵列的任何提示? 感谢。
答案 0 :(得分:0)
任何人阅读: 在@JonStirling(评论)的帮助下,这个问题得到了解决。
$xreceiver_info = $Listing->getDetails();
<?php print_r($xreceiver_info['job_title']);?>
$Listing
是在OP中输出代码块的变量,我将getDetails()
getter放入xreceiver_listing
类,就像Jon建议的那样。