我正在使用以下代码:
$tolettpe = "Sale";//default
if($_REQUEST[\'tolettype\']) $tolettpe = $_REQUEST[\'tolettype\'];
else if($_REQUEST[\'srch_type\']) $tolettpe = $_REQUEST[\'srch_type\'];
$args = array(
\'numberposts\' => $latestcount,
\'category\' => $catidstr,
\'meta_key\' => \'property_type\',
\'meta_compare\' => \'LIKE\',
\'meta_value\' => $tolettpe.\'%\'
);
$post_content = get_posts($args);
数据库中的值为“Sale | |”,请求中没有查询字符串变量。但查询不返回任何结果。
如果我使用精确的值,并且没有meta\\u比较,它就可以工作。
有什么办法可以让这一切顺利进行吗?