class A1{ const V1='100'; const V2='200'; const V3='Hello world'; } $v1 = 'V3'; $a1 = constant('A1::'.$v1); $a2 = A1::V3; echo $a1;
這個a1就等價於a2,做到動態獲取常量的內容
class A1{ const V1='100'; const V2='200'; const V3='Hello world'; } $v1 = 'V3'; $a1 = constant('A1::'.$v1); $a2 = A1::V3; echo $a1;
這個a1就等價於a2,做到動態獲取常量的內容
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。