php – 使用特徵 trait 定義屬性

直接在 trait 裡面定義即可,寫法如同 class 一樣。

但如果 class 中也定義了 trait 已有的屬性,且屬性質相異,那就會發生錯誤。

 


發表迴響