我有以下代码:
$o_search = new ObjectSearch();
$o_search -> user = $user;
$o_search -> date =':"2012"';
$o_search -> chtype = 'created';
echo "Changetype: " . $o_search -> chtype . "<br/>\n";
echo "User: " . $o_search -> user . "<br/>\n" ;
echo "Date: " . $o_search -> date . "<br/>\n" ;
$result = $o_search->search($o_search->chtype , $o_search->user , $o_search->date);
最后一行是我遇到麻烦的地方。将这些参数传递给“搜索”方法的正确语法是什么?如果我用有效的字符串替换这些参数,代码就可以工作。接下来是 objectSearch 类:
include_once(__CA_LIB_DIR__."/ca/Search/BaseSearch.php");
include_once(__CA_LIB_DIR__."/ca/Search/ObjectSearchResult.php");
class ObjectSearch extends BaseSearch {
# ----------------------------------------------------------------------
/**
* Which table does this class represent?
*/
protected $ops_tablename = "ca_objects";
protected $ops_primary_key = "object_id";
# ----------------------------------------------------------------------
public function &search($ps_search, $pa_options=null) {
return parent::doSearch($ps_search, new ObjectSearchResult(), $pa_options);
}
# ----------------------------------------------------------------------
}
提前致谢。