[英]How can i call static php variable?
我想知道如何在<>之間插入:self :: $ tag,謝謝
我嘗試了<{self :: $ tag}>,但是它不起作用。
<?php
class model {
public static $tag = "p" ;
private static function surround($xx){
return "<self::$tag>".$xx." </self::$tag>" ;
} //here is the problem
public static function label($xx){
return self::surround("<label>".$xx."</label>") ;
}
}
?>
你近了 僅字符串連接是錯誤的。 嘗試這個:
return "<".self::$tag.">".$xx." </".self::$tag.">" ;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.