我想检查是否有任何背后的/index.php/' 参数必须被忽略,并且没有/index.php/的baseurl也必须被忽略。 我知道PHP在链接中获得secundary的东西
if (strpos($url, 'contact') !== false){ }
,但我不知道如何使用它来检查URL的第二部分,任何东西,但参数。 我该怎么做?
例如:
localhost:8080/ - returns false.
localhost:8080/index.php - returns false.
localhost:8080/index.php/ - returns false.
localhost:8080/index.php?id=0 - returns false.
localhost:8080/index.php/contact - returns true.
您可以使用基名+ parse_url或explose例如:回声基本名称(parse_url($ _ SERVER [ 'REQUEST_URI'],PHP_URL_PATH)); – Kate
您在这里添加了Joomla标签。你想做什么?如果你添加一些上下文,你可能会得到更好的答案。 –
joomla标签在这里,因为该网站是建立在joomla上。 这个结果只有一个页面可以处理,而不是每个链接都有一个单独的页面。 –