題目描述題目來源及自己的思路輸出Parent:parent_only=fromchild,both_distinct=fromparentChild:parent_only=fromchild,both_distinct=fromchild,child_only=fromchildhttps://www.php.net/manual/zh...相關代碼//請把代碼文本粘貼到下方(請勿用圖片代替代碼)$a=newstaticparent;var_dump(get_class_vars("staticparent"));$a=newstaticchild;echo"";var_dump(get_class_vars("staticparent"));出現以下結果array(2){["parent_only"]=>string(10)"fromparent"["both_distinct"]=>string(10)"fromparent"}array(2){["parent_only"]=>string(9)"fromchild"["both_distinct"]=>string(10)"fromparent"}我想咨詢下,為什么newstaticchild后父類的parent_only會被修改,而both_distinct卻不會.另外輸出的原因是什么,而且把注釋里面self::打開,替換static,結果為何是一致Parent:parent_only=fromchild,both_distinct=fromparentChild:parent_only=fromchild,both_distinct=fromchild,child_only=fromchild
有沒有人遇到過這個問題哈!php中繼承Static與延遲綁定
慕婉清6462132
2019-10-16 16:50:06