Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何返回上一页并保留ID';URL代码点火器中的s_Php_Codeigniter_Url - Fatal编程技术网

Php 如何返回上一页并保留ID';URL代码点火器中的s

Php 如何返回上一页并保留ID';URL代码点火器中的s,php,codeigniter,url,Php,Codeigniter,Url,这是我在返回中的代码 <a href="<?=site_url($controller)?>"><i class="icon-chevron-left"></i> Go Back</a> <br><br> 我的问题是,我如何才能回到我的上一页,我的身份证保留在我的上一页像这样 这是我的上一页: scms/contracts/serial/3 这是我的当前页面: scms/合同/查看/下午3点/每月 ---

这是我在返回中的代码

<a href="<?=site_url($controller)?>"><i class="icon-chevron-left"></i> Go Back</a>
<br><br>



我的问题是,我如何才能回到我的上一页,我的身份证保留在我的上一页像这样

这是我的上一页: scms/contracts/serial/3

这是我的当前页面: scms/合同/查看/下午3点/每月


----我想回到“/scms/contracts/serial/3”

我不知道CodeIgniter,但你可以用老方法来做:

$ref = $_SERVER['HTTP_REFERER'];
if(strpos($ref, '://your-site.com') !== false) {
     echo '<a href="' . $ref . '"><i class="icon-chevron-left"></i> Go Back</a>';
} else {
     echo '<a href="javascript:history.back(-1);"><i class="icon-chevron-left"></i> Go Back</a>';
}
$ref=$\u服务器['HTTP\u REFERER'];
if(strpos($ref,://your site.com')!==false){
回声';
}否则{
回声';
}

我不知道CodeIgniter,但你可以用老办法:

$ref = $_SERVER['HTTP_REFERER'];
if(strpos($ref, '://your-site.com') !== false) {
     echo '<a href="' . $ref . '"><i class="icon-chevron-left"></i> Go Back</a>';
} else {
     echo '<a href="javascript:history.back(-1);"><i class="icon-chevron-left"></i> Go Back</a>';
}
$ref=$\u服务器['HTTP\u REFERER'];
if(strpos($ref,://your site.com')!==false){
回声';
}否则{
回声';
}



在控制器中,您可以使用以下命令:

echo "<script>window.location.href='javascript:history.back(-1);'</script>";
您可以使用以下警告信息:

echo "<script>alert('*Alert messages here...*');window.location.href='javascript:history.back(-1);'</script>";
echo“警报('*alert messages here…*');window.location.href='javascript:history.back(-1);”;

在控制器中,您可以使用以下命令:

echo "<script>window.location.href='javascript:history.back(-1);'</script>";
您可以使用以下警告信息:

echo "<script>alert('*Alert messages here...*');window.location.href='javascript:history.back(-1);'</script>";
echo“警报('*alert messages here…*');window.location.href='javascript:history.back(-1);”;

重定向到上一页的最简单方法是,试试这个,它对我有用吗

 redirect($this->agent->referrer());
您还需要导入用户代理库

$this->load->library('user_agent');

您的id也将保留。

重定向到上一页的最简单方法是,试试这个,它对我有用

 redirect($this->agent->referrer());
您还需要导入用户代理库

$this->load->library('user_agent');
您的id也将保留