0

我有以下代码:

$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);
        }
        # ----------------------------------------------------------------------
}

提前致谢。

4

1 回答 1

0

好吧,这很尴尬,就像输入正确一样简单......

$result = $o_search->search( $o_search->chtype. ".". $o_search->user. '.:"' . $o_search->date . '"' );

我必须在正确的地方添加标点符号。希望这可以帮助某人。

于 2013-05-24T20:00:54.107 回答