本文整理汇总了PHP中ArrayUtil::arrayToQueryString方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayUtil::arrayToQueryString方法的具体用法?PHP ArrayUtil::arrayToQueryString怎么用?PHP ArrayUtil::arrayToQueryString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil::arrayToQueryString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getQueryString
private function getQueryString()
{
$request_params = $this->context->getRequest()->getParameterHolder()->getAll();
return ArrayUtil::arrayToQueryString($request_params, array("module", "action"));
}
示例2: doUpdate
private function doUpdate($dir, $module_name = null)
{
$input = scandir($dir);
foreach ($input as $file) {
$tmp = $dir . "/" . $file;
if ($file == "." || $file == ".." || $file == ".svn" || substr($file, 0, 1) == ".") {
continue;
}
if ($file != "config" && is_dir($tmp)) {
if (!($obj = afWidgetCategoryPeer::getCategoryByModule($file))) {
$this->logSection("\n\nFound new module: " . $file . "\n", null);
if (!file_exists($tmp . "/config") || !is_dir($tmp . "/config") || !$this->hasXmlFiles(scandir($tmp . "/config"))) {
$this->logSection("No widgets found, skipping..", null, null, "COMMENT");
continue;
}
if ($this->args["all"] == "no" && !$this->askConfirmation("Would you like the module to be processed (y / n)", "QUESTION", "y")) {
continue;
}
$tmp_name = ucwords(sfInflector::humanize($file));
$longname = trim($this->ask("Please provide a name for this module (" . $tmp_name . " by default):", "INFO"));
echo "\n\n";
if ($longname == "") {
$longname = $tmp_name;
}
$cat_id = afWidgetCategoryPeer::addNewItem($file, $longname);
} else {
$longname = $obj->getName();
$cat_id = $obj->getId();
$this->logSection("\n\nFound existing module: " . $file . "\n", null);
if (!file_exists($tmp . "/config") || !is_dir($tmp . "/config")) {
$this->logSection("No widgets found, skipping..", null, "COMMENT");
continue;
}
}
$this->fixtures["category"]["data"] .= " category" . $cat_id . ":\r\n module: " . $file . "\n name: " . $longname . "\n";
$this->doUpdate($tmp . "/config", $file);
} else {
if (strtolower(substr($tmp, strrpos($tmp, ".") + 1)) == "xml") {
$base = str_replace(".xml", "", $file);
$url = $module_name . "/" . $base;
$params = null;
$permission = $this->isUnAllowedWidget($url);
if ($permission == FALSE) {
$this->logSection("Found unallowed widget (skipping): ", ucfirst($base), null, "COMMENT");
continue;
} else {
}
if (!($obj = afWidgetSelectorPeer::getWidgetByUrl($url))) {
$new = true;
$msg = "new";
} else {
$new = false;
$msg = "existing";
$wid_id = $obj->getId();
$cid = $obj->getCategoryId();
}
if (isset($this->pages[$url]) && ($new || !$new && !$obj->getParams())) {
$this->logSection("Found " . $msg . " widget, requires params: ", ucfirst($base), null);
$item = $this->pages[$url];
$no = 0;
foreach ($item["combos"] as $file => $set) {
$this->logSection("\n\nOption [" . ($no + 1) . "]", "(page: " . $file . ")", 60, "QUESTION");
foreach ($set as $name => $value) {
$this->logSection(null, $name . " = " . $value, null);
}
$no++;
}
echo "\n\n";
while (1) {
$selected = trim($this->ask("Please choose one of the above configs or hit enter to add custom one:", "QUESTION"));
if ($selected === "" || $selected > 0 && $selected <= count($item["combos"])) {
if ($selected === "") {
$selected = trim($this->ask("Please provide parameters as a query string:", "QUESTION"));
} else {
$no = 0;
foreach ($item["combos"] as $tmp) {
if ($no == $selected - 1) {
$selected = $tmp;
break;
}
$no++;
}
}
break;
}
}
if (is_array($selected)) {
$params = ArrayUtil::arrayToQueryString($selected);
} else {
$params = $selected;
}
}
if ($new) {
$cid = afWidgetCategoryPeer::getCategoryByModule($module_name)->getId();
$wid_id = afWidgetSelectorPeer::addNewItem($url, $cid, $params, $permission);
} else {
$params = $obj->getParams();
}
$this->widgets[] = $wid_id;
$this->fixtures["selector"]["data"] .= " widget" . $wid_id . ":\r\n url: " . $url . "\n category_id: category" . $cid . "\n params: " . $params . "\n permission: " . $permission . "\n";
//.........这里部分代码省略.........