创建文件example1.php,放到phpbb根目录下,如下:
运行后输出
[quote]
Anonymous
admin
AdsBot [Google]
Alexa [Bot]
Alta Vista [Bot]
Ask Jeeves [Bot]
Baidu [Spider]
Exabot [Bot]
.........
allen
[/quote]
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
$sql = 'SELECT * FROM ' . USERS_TABLE ;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
echo $row['username'] . '<br/>';
}
?>
运行后输出
[quote]
Anonymous
admin
AdsBot [Google]
Alexa [Bot]
Alta Vista [Bot]
Ask Jeeves [Bot]
Baidu [Spider]
Exabot [Bot]
.........
allen
[/quote]