我回到这段代码并再次尝试,但给了我一些错误,所以我根据之前用这个新的答案制定的部分重新设计了它(在 Joomla 上运行良好!3.4.5)
// build the JInput object
$jinput = JFactory::getApplication()->input;
// retrieve the array of values from the request (stored in the application environment) to form the query
$uriQuery = $jinput->getArray();
// build the the query as a string
echo 'index.php?' . JUri::buildQuery($uriQuery);
Joomla!API 文档:JInput
-JUri
以前的答案:
谷歌搜索我发现了这个:
<?php
// "unparse" the Joomla SEF url to get the internal joomla URL
JURI::current();// It's very strange, but without this line at least Joomla 3 fails to fulfill the task
$router =& JSite::getRouter();// get router
$query = $router->parse(JURI::getInstance()); // Get the real joomla query as an array - parse current joomla link
$url = 'index.php?'.JURI::getInstance()->buildQuery($query);
?>
我已经用 Joomla 测试过了!3.4.4 和它的工作正常!不知道它是否可以与 1.5 一起使用