Php codeigniter 3中存在500内部服务器错误
我的Codeigniter逻辑中有500个内部服务器错误。在控制台中,它看起来像这样 POST 500内部服务器错误jquery.min.js:2 我相信错误是由于我的.htaccess文件引起的,但我无法找到正确的错误。如果你需要更多的代码,请告诉我Php codeigniter 3中存在500内部服务器错误,php,mysql,codeigniter-3,Php,Mysql,Codeigniter 3,我的Codeigniter逻辑中有500个内部服务器错误。在控制台中,它看起来像这样 POST 500内部服务器错误jquery.min.js:2 我相信错误是由于我的.htaccess文件引起的,但我无法找到正确的错误。如果你需要更多的代码,请告诉我 <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Livesearch extends CI_Controller {
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Livesearch extends CI_Controller
{
function __Construct()
{
parent::__Construct();
$this->load->model('Items');
}
public function index()
{
$this->load->view('livesearch');
}
public function search()
{
$search_data = $_POST['search_data'];
$query = $this->Items->get_live_items($search_data);
foreach ($query as $row):
echo "<li><a href='#'>" . $row->title . "</a></li>";
endforeach;
}
}
打开application\config\autoload.php文件并将数据库添加到$autoload['libraries']数组中
示例:$autoload['libraries']=array'database' 500是一个内部服务器错误。因此,查看服务器日志文件以了解更多信息请花时间正确格式化问题中的代码。这在我编辑之前是不可读的。@Jens如何查看服务器日志文件以获取更多信息?@neetuyadav您正在apache Web服务器上运行吗?因此,请查看错误日志文件。顺便说一句,如果你在开发软件,你应该知道你的日志在哪里files@Jens这是我的日志错误PHP致命错误:调用C:\\xampp\\htdocs\\aplucollege\\application\\models\\Items.PHP第8行中的成员函数select on null,参考:
<?php
class Items extends CI_Model
{
function get_live_items($search_data)
{
$this->db->select("title,description");
$this->db->from('item');
$this->db->group_start();
$this->db->like('title', $search_data);
$this->db->or_like('description', $search_data);
$this->db->group_end();
$this->db->limit(10);
$this->db->order_by("id", 'desc');
$query = $this->db->get();
return $query->result();
}
}
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1