PHP代码如果url的一部分包含*this*则执行*this*

Rat*_*ich 2 html php joomla

我有一个joomla网站.我有一个index.php,其中包含显示带div的div + HTML代码的PHP代码

我有另一个index.php应该继续使用/ en和/ fr版本.我有另一个版本的index.php,我在上面描述过.我需要在/ ru版本上显示一个index.html,在/ en +/fr版本上显示另一个.

换句话说,我需要回显一些代码mysite.com/rumysite.com/en+上的另一个代码mysite.com/fr

<?php
$url = "http://mysite/en/";
$currentpage = $_SERVER['REQUEST_URI'];
if($url==$currentpage) {
echo 'index.html version one'
?>
Run Code Online (Sandbox Code Playgroud)

但这没效果.

Ana*_*Die 5

使用strpos(): -

if(strpos($url ,'en/') !== FALSE || strpos($url ,'fr/') !== FALSE) {
echo 'index.html version one';
}
if(strpos($url ,'ru/') !== FALSE){
echo 'index.html version two';
}
Run Code Online (Sandbox Code Playgroud)

示例链接: - https://eval.in/734505

参考: - http://php.net/manual/en/function.strpos.php