MediaWiki cannot get path

冷暖自知 提交于 2019-12-25 03:36:32

问题


My MediaWiki cannot get the path of my live web server. Here is the code:

$script = $_SERVER['SCRIPT_NAME'];
$path = pathinfo( $script, PATHINFO_DIRNAME ) . '/';
$path = str_replace( '//', '/', $path );
$ext = pathinfo( $script, PATHINFO_EXTENSION );

echo "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\">enter</a>";

The localhostwebserver displays the echo as: Please <a href=wiki.website.com/mw-config/index.php\">enter</a>,

but the live server displays the echo as Please <a href=\/mw-config/index.php\">enter</a>

How is that possible? Need help!


回答1:


If you need the url of the current page in php, I can recommend this script. I have used it successfully for years.



来源:https://stackoverflow.com/questions/7696756/mediawiki-cannot-get-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!