【发布时间】:2023-03-31 10:27:01
【问题描述】:
我想从 CMS 的数据库中获取前缀。
我制作了这段代码,但是当 db 中有更多 CMS(Joomla、Opencart、Wordpress)或进行备份时,它不起作用。可以更优雅地访问前缀吗?
$this->connectDB();
$result = mysql_query("show tables;");
while($row = mysql_fetch_row($result)){
$allRows[] = $row[0];
}
$index = preg_grep("/^.+_user$/", $allRows);
$pieces = explode("_", array_pop($index));
$this->_prefix=$pieces[0]."_"
;
【问题讨论】:
标签: php mysql content-management-system