どのようにcidを指して、値を取得しますか?PHPオブジェクト、参照方法?
$ item->?
array(1) {
[0]=>
object(__PHP_Incomplete_Class)#4 (4) {
["__PHP_Incomplete_Class_Name"]=>
string(7) "Product"
["_param:protected"]=>
array(40) {
["pid"]=>
string(3) "540"
["cid"]=>
string(2) "22"
["sid"]=>
string(1) "1"
["tid"]=>
string(1) "9"
["sales_volume"]=>
string(1) "0"
["preorder_volume"]=>
string(1) "0"
["viewed"]=>
string(1) "0"
["weight"]=>
string(4) "0.00"
["delivery_type"]=>
string(6) "postal"
["cash_price"]=>
string(4) "0.00"
["coupon_price"]=>
string(4) "0.00"
["coupon_require"]=>
NULL
["member_price"]=>
NULL
["discount_code"]=>
NULL
["special_offer"]=>
string(1) "0"
["lan"]=>
string(13) "eng,tchi,schi"
["special_offer_price"]=>
string(4) "0.00"
["special_offer_begin"]=>
string(19) "2010-09-06 11:25:05"
["special_offer_end"]=>
string(19) "2010-09-06 11:25:05"
["bonus_point"]=>
string(1) "0"
["tax"]=>
string(4) "0.00"
["release_date"]=>
string(19) "2010-09-06 11:25:05"
["begin_datetime"]=>
string(19) "2010-07-13 14:41:26"
["end_datetime"]=>
NULL
["delivery_status"]=>
string(4) "24hr"
["stock"]=>
string(1) "0"
["status"]=>
NULL
["discon"]=>
string(1) "0"
["product_desc"]=>
string(0) ""
["model_num"]=>
string(8) "ATH-BT03"
["rating"]=>
string(0) ""
["recycle_id"]=>
array(2) {
[0]=>
string(1) "5"
[1]=>
string(2) "20"
}
}
}
["doc:private"]=>
object(DOMDocument)#5 (0) {
}
}
}
いいえ、これは方法ではありません。それが可能ならば、保護されたメンバーを持つという目的を破るだろうか?代わりに 'Reflection'クラスを探します。 – Mchl
メンバーを持つクラスは、その値を読み取り専用にする必要があります。ゲッターメソッドを持つことは、これに対して完全に正当なものですか?そうではありませんか? – Jeff
これは正しいですが、getterメソッドもこのクラスのメンバでなければなりません。多分それがあなたが実際に意味していたものです。私は誤解しているかもしれません。 – Mchl