我想在调用raw
时访问$ lastID有没有办法做到这一点?外部世界可访问的函数内的变量
public static $lastID;
public function raw($sql){
if(!$result = mysql_query($sql)){
throw new Exception("Could not perform query: " .mysql_error());
}
self::$lastID = mysql_insert_id();
return($result);
}
编辑:它是一个类成员,它是静态的。
好的,我宣布它是静态的,但我仍然感到困惑,因为我如何在课堂外访问它。 – kylex 2010-02-11 15:36:42
NM,算出来: CLASSNAME :: $ lastID; – kylex 2010-02-11 15:40:31