2012-07-15 42 views
-2

在下面的代码功能:显示PHP链路

return $_SERVER['PHP_SELF']; 

输出为:/mysqlTilestore/listing.php

和在下面的代码功能:

return $mypage 

的输出为:page = 5

如何将上述两种代码结合返回以下:

/mysqlTilestore/listing.php/?page=5

我试过以下,但我得到的语法错误:

return $_SERVER['PHP_SELF']?$mypage; 
+0

推荐阅读:http://php.net/manual/en/language.types.string.php和http://php.net/manual/en/language.operators.string.php – 2012-07-15 20:37:25

回答

0

?需要被引用为一个字符串:

return $_SERVER['PHP_SELF'] . '?' . $mypage; 
1
$path = $_SERVER['PHP_SELF'] . '?' . $mypage; 
return $path;