私は codeigniter の初心者で、過去数日からウェブサイトを開発しています。Web サイトは localhost で正常に動作していますが、ライブ Web サーバーでその Web サイトをテストすると、次のエラーが発生します。
500内部サーバーエラー。お探しのリソースに問題があり、表示できません。さまざまなチュートリアルで利用できる .htaccess ソリューションのような多くのことを試しましたが、成功しませんでした。次に、自己デバッグを試みたところ、モデルの読み込み行をコメントアウトすると、データベースから取得する必要のあるデータなしでインデックスページが読み込まれることがわかりました。しかし、その行からコメントを削除するとすぐに、同じエラーが再び発生します. 次に、モデルをチェックしましたが、そのような問題は見つかりませんでした。今は .htaccess を使用していません。サーバー上の PHP バージョン:5.2.17 codeigniter バージョン:CodeIgniter_2.1.4
------------------------コントローラーの私のコードは--------------------- ------------
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<?php
class video extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->model('video_model');
$this->load->helper('html');
$this->load->library('session');
}
function index()
{
$this->session->unset_userdata('searchterm');
$data['latest_video']=$this->latest_video();
$data['uk_video']=$this->uk_video();
$data['hm_video']=$this->hm_video();
$this->load->view('index',$data);
}
function watch()
{
$v_type=$this->uri->segment(3);
$v_id=$this->uri->segment(4);
if($v_type && $v_id)
{
$data['multiple_videos']=$this->video_model->get_all_videos($v_type);
$data['single_video']=$this->video_model->get_single_video($v_id,$v_type);
$counter= $data['single_video'][0]['counter'];
$id= $data['single_video'][0]['v_id'];
$this->load->view('watch',$data);
$this->view_counter($id,$counter);
}
else
{
redirect('video','refresh');
}
}
function latest_video()
{
$data[]=$this->video_model->get_latest_video();
return $data;
}
function uk_video()
{
$data[]=$this->video_model->get_uttrakhand_video();
return $data;
}
function hm_video()
{
$data[]=$this->video_model->get_himachal_video();
return $data;
}
function result()
{
$this->load->view('search');
}
function view_counter($id,$counter)
{
$user_ip=$this->input->ip_address();
if(!$this->input->cookie($id))
{
$cookie=array('name'=>$id,'value'=>$user_ip,'expire'=>43200);
$this->input->set_cookie($cookie);
$counter++;
}
if($this->input->cookie($id))
{
if($this->input->cookie($id,TRUE)!=$user_ip)
{
$counter=+$counter;
}
}
$update=array('counter'=>$counter);
$this->db->where('v_id',$id);
$this->db->update('tblvideo',$update);
}
}
?>
------------------------モデルの私のコードは--------------------- ------------
<?php class video_model extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->database();
}
function get_latest_video()
{
$this->db->select('v_id,v_name,v_title,v_description,v_image,v_type,v_duration,v_time,counter')->from('tblvideo')->order_by('v_time','DESC')->limit(3);
$query=$this->db->get();
return $latest_data=$query->result_array();
}
function get_uttrakhand_video()
{
$this->db->select('v_id,v_name,v_title,v_description,v_image,v_type,v_duration,v_time,counter')->from('tblvideo')->where('v_type','uk')->order_by('v_time','DESC')->limit(4,3);
$query=$this->db->get();
return $latest_data=$query->result_array();
}
function get_himachal_video()
{
$this->db->select('v_id,v_name,v_title,v_description,v_image,v_type,v_duration,v_time,counter')->from('tblvideo')->where('v_type','hm')->order_by('v_time','DESC')->limit(4,3);
$query=$this->db->get();
return $latest_data=$query->result_array();
}
function insert_data()
{
$data=array(
'v_title'=>$this->input->post('v_title'),
'v_name'=>$this->input->post('v_name'),
'v_description'=>$this->input->post('v_description'),
'v_tags'=>$this->input->post('v_tags'),
'v_duration'=>$this->input->post('v_duration'),
'v_type'=>$this->input->post('v_type')
);
return $this->db->insert('tblvideo',$data);
echo "data inserted";
}
function get_single_video($v_id,$v_type)
{
$cond=array('v_id'=>$v_id,'v_type'=>$v_type);
$this->db->select('v_id,v_name,v_title,v_description,v_image,v_type,v_duration,v_time,counter')->from('tblvideo')->where($cond);
$res=$this->db->get();
return $res->result_array();
}
function get_all_videos($v_type)
{
$this->db->select('v_id,v_name,v_title,v_description,v_image,v_type,v_duration,v_time,counter')->from('tblvideo')->where('v_type',$v_type)->order_by('v_time','DESC')->limit(30);
$query=$this->db->get();
return $query->result_array();
}
function get_video_list($limit,$offset)
{
$offset=intval($offset);
$this->db->select('v_id,v_name,v_title,v_description,v_tags,v_image,v_type,v_duration,v_time,counter')->from('tblvideo')->order_by('v_time','DESC')->limit($limit,$offset);
$query=$this->db->get();
return $query->result_array();
}
function get_total_number_videos()
{
$this->db->select('v_id,v_name,v_title,v_description,v_tags,v_image,v_type,v_duration,v_time,counter')->from('tblvideo')->order_by('v_time','DESC');
$query=$this->db->get();
return $query->num_rows();
}
function video_edit($v_id)
{
$this->db->select('v_id,v_name,v_title,v_description,v_image,v_tags,v_type,v_duration,v_time')->from('tblvideo')->where('v_id',$v_id);
$query=$this->db->get();
return $query->result_array();
}
function video_update($id,$table,$form_data)
{
$this->db->where('v_id',$id);
return $response=$this->db->update($table,$form_data);
}
function delete($id,$table)
{
$this->db->delete($table, array('v_id' => $id));
}
function user_authentication($u_name,$pwd)
{
$array=array('username'=>$u_name,'password'=>$pwd,'type'=>'admin');
$this->db->select('username,password,id,type')->from('tblusers')->where($array);
$query=$this->db->get();
return $query->num_rows();
}
function user_data($u_name,$pwd)
{
$array=array('username'=>$u_name,'password'=>$pwd,'type'=>'admin');
$this->db->select('username,password,id,type')->from('tblusers')->where($array);
$query=$this->db->get();
return $query->result_array();
}
}?>
please take look at the problem thank you...