使用query_vars获取多个参数

时间:2016-03-27 03:43:42

标签: php wordpress

在functions.php中

awk -F= '$2 ~ /<br>/ { print $1 }' MyProject.properties

如何获取假设url具有所有参数的参数?在我的主题php文件中。我用

function add_query_vars_uniqlo($aVars) {
    $aVars[] = array("qtext",
                     "qbrand",
                    "qnew",
                    "qdiscount",
                    "qlimit",
                    "qmulti",
                    "qonline",
                    "qspsize",
                    "qrange",
                    "qcolor",
                    "qsize",
                    "qicon",
                    "qstart",
                    "sort",
                    "qclv1",
                    "uniqlo_url");

    return $aVars;
}
// hook add_query_vars function into query_vars
add_filter('query_vars', 'add_query_vars_uniqlo');

global $wp_query; $aVars[] = array("qtext", "qbrand", "qnew", "qdiscount", "qlimit", "qmulti", "qonline", "qspsize", "qrange", "qcolor", "qsize", "qicon", "qstart", "sort", "qclv1", "uniqlo_url"); if(isset($wp_query->query_vars($aVars))) { //Do some thing} 是否正确?

0 个答案:

没有答案