提交或更新Codeigniter中的任何内容后不显示更新的数据

时间:2019-02-28 12:36:25

标签: php codeigniter session server session-cookies

我最近将我的网站转移到了另一台服务器。除了一件事,一切都正常工作。当我在网站上提交或更新任何数据时,它不会显示更新的数据。无论我重新提交或更新数据多少次,它始终显示旧数据。当我单击浏览器上的重新加载按钮时,它仅显示更新的数据。

注意:在我的数据库上,它运行正常。我的旧网站运行正常。我在每个控制器上使用redirect()刷新

这是我的config.php

<?php  if(!defined('BASEPATH'))exit('No direct script access allowed');

$config['base_url']='https://eshaplasticbd.net/';

$config['index_page']='';

$config['uri_protocol']='AUTO';

$config['url_suffix']='';



$config['language']='english';        $config['charset']='UTF-8';    
   $config['enable_hooks']=FALSE;          
   $config['subclass_prefix']='MY_';          
   $config['permitted_uri_chars']='a-z 0-9~%.:_\-';          
   $config['allow_get_array']=TRUE;          
   $config['enable_query_strings']=FALSE;      
   $config['controller_trigger']='c';      
   $config['function_trigger']='m';    $config['directory_trigger']='d';
   $config['log_threshold']=0;    $config['log_path']='';      
   $config['log_date_format']='Y-m-d H:i:s';      
   $config['cache_path']='';      
   $config['encryption_key']='bds@urcing123';      
   $config['sess_cookie_name']='ci_session';      
   $config['sess_expiration']=7200;      
   $config['sess_expire_on_close']=FALSE;      
   $config['sess_encrypt_cookie']=FALSE;      
   $config['sess_use_database']=TRUE;      
   $config['sess_table_name']='ci_sessions';      
   $config['sess_match_ip']=FALSE;      
   $config['sess_match_useragent']=TRUE;      
   $config['sess_time_to_update']=300;    $config['cookie_prefix']="";  
   $config['cookie_domain']="";    $config['cookie_path']="/";      
   $config['cookie_secure']=FALSE;      
   $config['global_xss_filtering']=FALSE;      
   $config['csrf_protection']=FALSE;      
   $config['csrf_token_name']='csrf_test_name';      
   $config['csrf_cookie_name']='csrf_cookie_name';      
   $config['csrf_expire']=7200;    $config['compress_output']=FALSE;    
   $config['time_reference']='local';      
   $config['rewrite_short_tags']=FALSE;    $config['proxy_ips']='';     
   $config['sess_save_path'] = 'ci_sessions';      
   $config['sess_regenerate_destroy'] = FALSE;

此处的autoload.php文件:

 $autoload['helper'] = array('url', 'form','file');
    $autoload['config'] = array();
    $autoload['language'] = array();

    $autoload['model'] = array('log_model');

router.php文件在此处:

<?php  if(!defined('BASEPATH'))exit('No direct script access allowed');
if ($_SERVER["SERVER_NAME"]!=='eshaplasticbd.net'){ die ("License ERROR!!!");} else { $route['default_controller'] = 'main'; }
$route['404_override']='';

控制器代码示例:

<?php session_start(); ?>
<?php if(!defined('BASEPATH'))exit('No direct script access allowed');

    class main extends CI_Controller{function __construct(){
    parent::__construct();}
    function index(){$data=array();

if(!$this->session->userdata('is_logged_in')){
        redirect('index.php/main/login','refresh');exit;}

        if($this->session->userdata('org_id')){$this->load->model('config_model');$uid=$this->session->userdata('user_details')->id;$data['btns']=$this->config_model->get_btns('MAIN',$uid);$data['err']="";

        if(count($data['btns'])==1){redirect($data['btns'][0]->btn_url,'refresh');exit;}if(count($data['btns'])==0){$data['err']="NO PERMISSION ASSIGNED IN MAIN!!!";}$data['main_container']='main';

        if($this->session->userdata('user_details')->role_id =='2'){$data['main_container']='hr/main';}if($this->session->userdata('user_details')->role_id=='3'){

redirect('index.php/hrgroup/attendance','refresh');exit;}

        if($this->session->userdata('user_details')->role_id =='s_2'){

redirect('index.php/salesgroup/sales/sales_list','refresh');exit;}

        if($this->session->userdata('user_details')->role_id =='stock_user'){

redirect('index.php/salesgroup/sales/current_stock','refresh');exit;}

        if($this->session->userdata('user_details')->role_id =='invoice_user'){
redirect('index.php/salesgroup/sales/new_invoice','refresh');exit;}

if($this->session->userdata('user_details')->role_id =='purchase_entry'){
redirect('index.php/purchasegroup/purchase','refresh');exit;}$this->load->view('template',$data);}else{redirect('index.php/setting/','refresh');exit;}

    }

1 个答案:

答案 0 :(得分:0)

在控制器方法成功更新查询后,您可以使用redirect('routename');