gpt4 book ai didi

php - 如何在PHP中调用父类的非静态方法形成子类的静态方法

转载 作者:行者123 更新时间:2023-12-05 03:15:42 24 4
gpt4 key购买 nike

如何在 PHP 中调用父类的非静态方法形成子类的静态方法?请帮忙。

 public static function countryArray(){
$sql = "SELECT `country_id`, `country_name` FROM `dr_tbl_country`";
$resultSet = parent::dBQueryExecute($sql);
if(mysql_num_rows($resultSet) > 0){
$countryArray = array();
while($result = mysql_fetch_array($resultSet)){
extract($result);
$countryArray[$country_id]['country_id'] = $country_id;
$countryArray[$country_id]['country_name'] = $country_name;
}
return $countryArray;
}else{
return false;
}
}

最佳答案

你不能;静态项目与其他静态项目一起工作。

关于php - 如何在PHP中调用父类的非静态方法形成子类的静态方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13854653/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com