0
/*htaccess*/
    
    
         重写引擎开启
     RewriteCond $1 !^(index.php|resources|robots.txt|assets|images|js|css|upload|audious|favicon.png)
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule ^(.*)$ index.php/$1 [L,QSA]
    
    
    
    
    
    
    
    
    /*控制器Admin_access*/
    公共函数_add_audio()
        {
    
            if($this->input->post('upload_auds'))
            {
                    $this->form_validation->set_rules('word_id', 'word_id', 'trim|required');
                            
                    if ($this->form_validation->run() != FALSE)
                            {          
                                    $orginal_filename = $_FILES['audio']['name'];
                                    $new_name = time()." ".str_replace('','-',$orginal_filename);
    
                                    $配置 = [
    
                                    'upload_path' => './audios',
                                    'allowed_types' => 'mp3',
                                    "文件名" => $new_name,
    
                                    ];
                                    
                                      $this->load->library('upload', $config);
                                              if ( !$this->upload->do_upload('audio'))
                                                {
    
                                                        $this->session->set_flashdata('ERROR_AUDIO',$this->upload->display_errors());
                                                }
                                                别的
                                                {       
    
    
                                                 
    
    
                                                         $this->load->model('crud_models');
                                                         $response = $this->crud_models->update_data();
                            
                                                         如果($响应)
                                                         {
                                                            
                                                         
                                                            redirect('admin_access/add',$this->session->set_flashdata('SUCCESS_AUDIO','音频添加成功!'));
                                                         }
                                                         别的
                                                         {
                                                    
                                                         redirect('admin_access/add',$this->session->set_flashdata('ERROR_AUDIO','音频添加失败!'));
                                                       
                                                         }
                                                         
                                                              
                                                }
    
                                             
                            }
                            别的{
    
                                                              $this->session->set_flashdata('ERROR','无效格式!');
                                 $this->session->set_flashdata('ERROR',validation_errors());
    
    
                                
                            }
                    
              
            }
    
   
4

0 回答 0