如何返回一个href但不使用历史返回
我试着写这个 配置.php
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/webapp/';
在 index.php (我不知道要替换:
else{ die("wrong password <a href=\"javascript:history.back()\">back</a>");
最终目标是 在 index.php 上是表单登录 如果没问题,那么下一页。 如果错了那么我想创建链接回到http://localhost/webapp 不是http://localhost/webapp/index.php或其他历史网址
最佳答案
这就是你想要的:
die("wrong password <a href=\""
. substr( $_SERVER['HTTP_REFERER'], 0, strrpos( $_SERVER['HTTP_REFERER'], '/' ) )
. "\">back</a>");
编辑: 这会将您送回 http://localhost/webapp不是http://localhost/webapp/index.php
关于javascript - 反向链接但不使用历史记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33363408/