我在此代码的第 4 行收到错误消息。这对我来说没有意义。它昨天工作,现在它没有。
这是我在包含此内容后收到的错误消息:
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /PATH/classes/users.php on line 5
<?php
class Users {
public static function load($where = NULL, $order = 'name', $bind = NULL) {
global $db;
$sql = 'SELECT cspsp_accounts.*, cspsp_clans.id AS clan_id, cspsp_clans.name AS clan_name, cspsp_clans.tag AS clan_tag ' .
'FROM cspsp_accounts ' .
'LEFT JOIN cspsp_clanlinks ON cspsp_accounts.id=cspsp_clanlinks.account_id AND cspsp_clanlinks.active=1 AND cspsp_clanlinks.approved=1 ' .
'LEFT JOIN cspsp_clans ON cspsp_clans.id=cspsp_clanlinks.clan_id ' .
'WHERE (cspsp_accounts.id=cspsp_clanlinks.account_id OR cspsp_clanlinks.account_id IS NULL) ' . (($where) ? ('AND (' . $where . ') ') : ('')) .
'ORDER BY ' . $order;
$rows = $db->run($sql, $bind);
if(is_array($rows)) {
$users = array();
foreach($rows as $row) {
$users[] = new User($row);
}
return $users;
}
return false;
}
}
?>
这是完整的代码:http ://codepad.org/1qS7iwTv 谢谢大家提前!