A php error was encountered severity: 8192 ктонибудь в курсе?

0

Короче у меня умер комп а после переустановки системы установил xampp а базу данных создавать пришлось заново и вот открывая сайт сначала идет ошибка

A PHP Error was encountered
Severity: 8192

Message: Required parameter $limit follows optional parameter $slug

Filename: models/Films_model.php

Line Number: 9

Backtrace:

File: C:\xampp\htdocs\movieworld\application\core\MY_Controller.php
Line: 13
Function: model

File: C:\xampp\htdocs\movieworld\application\controllers\Main.php
Line: 8
Function: __construct

File: C:\xampp\htdocs\movieworld\index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: 8192

Message: Required parameter $limit follows optional parameter $slug

Filename: models/Serials_model.php

Line Number: 9

Backtrace:

File: C:\xampp\htdocs\movieworld\application\controllers\Main.php
Line: 18
Function: model

File: C:\xampp\htdocs\movieworld\index.php
Line: 315
Function: require_once

а дальше сам сайт
может поможете?

codeigniter

4 ответов

0
у меня так и есть
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Movies extends MY_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('Films_model');
    }

    public function index() {

		if(!$this->dx_auth->is_admin()) {
			show_404();
		}

		$this->data['title'] = 'All Movies';
		$this->data['movies'] = $this->Films_model->getMovies();

		$this->load->view('templates/header', $this->data);
		$this->load->view('movies/index', $this->data);
		$this->load->view('templates/footer');
	}

	public function view($slug = NULL) {

        $movie_slug = $this->films_model->getFilms($slug, false, false);

        if(empty($movie_slug)) {
            show_404();
        }

        $this->load->model('comments_model');
        $this->data['moviecomments'] = $this->comments_model->getMovieComments($movie_slug['id'], 100);

        $this->data['id'] = $movie_slug['id'];
        $this->data['slug'] = $movie_slug['slug'];
        $this->data['title'] = $movie_slug['name'];
        $this->data['year'] = $movie_slug['year'];
        $this->data['rating'] = $movie_slug['rating'];
        $this->data['descriptions_movie'] = $movie_slug['descriptions'];
        $this->data['player_code'] = $movie_slug['player_code'];
        $this->data['director'] = $movie_slug['director'];
        $this->data['category'] = $movie_slug['category_id'];

        $this->load->view('templates/header', $this->data);
        $this->load->view('movies/view', $this->data);
        $this->load->view('templates/footer');
    }

    public function type($slug = NULL) {
        $this->load->library('pagination');

        $this->data['movie_data'] = NULL;

        $offset = (int) $this->uri->segment(4);

        $row_count = 10;

        $count = 0;

        
        if($slug == "films") {
            $count = count($this->films_model->getFilms(false, PHP_INT_MAX));
            $p_config['base_url'] = '/movies/type/films/';
            $this->data['title'] = "Movies";
            $this->data['movie_data'] = $this->films_model->getMoviesOnPage($row_count, $offset, 1);
        }

        if($this->data['movie_data'] == null) {
            show_404();
        }

        $p_config['total_rows'] = $count;
        $p_config['per_page'] = $row_count;

        $p_config['full_tag_open'] = "<ul class='pagination'>";
		$p_config['full_tag_close'] ="</ul>";
		$p_config['num_tag_open'] = '<li>';
		$p_config['num_tag_close'] = '</li>';
		$p_config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
		$p_config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
		$p_config['next_tag_open'] = "<li>";
		$p_config['next_tagl_close'] = "</li>";
		$p_config['prev_tag_open'] = "<li>";
		$p_config['prev_tagl_close'] = "</li>";
		$p_config['first_tag_open'] = "<li>";
		$p_config['first_tagl_close'] = "</li>";
		$p_config['last_tag_open'] = "<li>";
		$p_config['last_tagl_close'] = "</li>";

        $this->pagination->initialize($p_config);

        $this->data['pagination'] = $this->pagination->create_links();

        $this->load->view('templates/header', $this->data);
        $this->load->view('movies/type', $this->data);
        $this->load->view('templates/footer');
    }

    public function create() {

		if(!$this->dx_auth->is_admin()) {
			show_404();
		}

		$this->data['title'] = 'Add Movie';

		if($this->input->post('slug') && $this->input->post('name') && $this->input->post('descriptions') && $this->input->post('year') && $this->input->post('rating') && $this->input->post('poster') && $this->input->post('player_code') && $this->input->post('director') && $this->input->post('add_date') && $this->input->post('category_id')) {

			$slug = $this->input->post('slug'); 
			$name = $this->input->post('name'); 
			$descriptions = $this->input->post('descriptions'); 
			$year = $this->input->post('year'); 
			$rating = $this->input->post('rating'); 
			$poster = $this->input->post('poster'); 
			$player_code = $this->input->post('player_code'); 
			$director = $this->input->post('director'); 
			$add_date = $this->input->post('add_date'); 
			$category_id = $this->input->post('category_id');

			if($this->Films_model->setMovies($slug, $name, $descriptions, $year, $rating, $poster, $player_code, $director, $add_date, $category_id)) {
				$this->data['title'] = 'Movie Added!';
				$this->load->view('templates/header', $this->data);
				$this->load->view('movies/created');
				$this->load->view('templates/footer');
			}
		}
		else{
			$this->load->view('templates/header', $this->data);
			$this->load->view('movies/create', $this->data);
			$this->load->view('templates/footer');
		}
	}
	
	public function edit($slug = NULL) {

		if(!$this->dx_auth->is_admin()) {
			show_404();
		}

		$this->data['title'] = 'Edit Movie';
		$this->data['movies_item'] = $this->Films_model->getMovies($slug);

		if (empty($this->data['movies_item'])) {
			show_404();
		}
		
		$this->data['id_movies'] = $this->data['movies_item']['id'];
		$this->data['slug_movies'] = $this->data['movies_item']['slug'];
		$this->data['name_movies'] = $this->data['movies_item']['name'];
		$this->data['descriptions_movies'] = $this->data['movies_item']['descriptions'];
		$this->data['year_movies'] = $this->data['movies_item']['year'];
		$this->data['rating_movies'] = $this->data['movies_item']['rating'];
		$this->data['poster_movies'] = $this->data['movies_item']['poster'];
		$this->data['player_code_movies'] = $this->data['movies_item']['player_code'];
		$this->data['director_movies'] = $this->data['movies_item']['director'];
		$this->data['add_date_movies'] = $this->data['movies_item']['add_date'];
		$this->data['category_id_movies'] = $this->data['movies_item']['category_id'];

		if($this->input->post('slug') && $this->input->post('name') && $this->input->post('descriptions') && $this->input->post('year') && $this->input->post('rating') && $this->input->post('poster') && $this->input->post('player_code') && $this->input->post('director') && $this->input->post('add_date') && $this->input->post('category_id')) {

			$id = $this->data['movies_item']['id'];
			$slug = $this->input->post('slug'); 
			$name = $this->input->post('name'); 
			$descriptions = $this->input->post('descriptions'); 
			$year = $this->input->post('year'); 
			$rating = $this->input->post('rating'); 
			$poster = $this->input->post('poster'); 
			$player_code = $this->input->post('player_code'); 
			$director = $this->input->post('director'); 
			$add_date = $this->input->post('add_date'); 
			$category_id = $this->input->post('category_id');

			if($this->Films_model->updateMovies($id, $slug, $name, $descriptions, $year, $rating, $poster, $player_code, $director, $add_date, $category_id)) {
				$this->data['title'] = 'Succesfully Updated';
				$this->load->view('templates/header', $this->data);
				$this->load->view('movies/edited');
				$this->load->view('templates/footer');
			}
		}
		else{
			$this->load->view('templates/header', $this->data);
			$this->load->view('movies/edit', $this->data);
			$this->load->view('templates/footer');
		}

	}
    
    public function delete($slug = NULL) {

		if(!$this->dx_auth->is_admin()) {
			show_404();
		}

		$this->data['movies_delete'] = $this->Films_model->getMovies($slug);

		if(empty($this->data['movies_delete'])) {
			show_404();
		}

		$this->data['title'] = "Delete Movie";
		$this->data['result'] = "Error Deleting ".$this->data['movies_delete']['name'];

		if($this->Films_model->deleteMovies($slug)) {
			$this->data['result'] = $this->data['movies_delete']['name']." Succesfully Deleted";
		}

		$this->load->view('templates/header', $this->data);
		$this->load->view('movies/delete', $this->data);
		$this->load->view('templates/footer');

    }
    
    public function comment() {

		if(!$this->dx_auth->is_logged_in()) {
			show_404();
		}

		$this->data['title'] = 'Add Commentary';

		if($this->input->post('user_id') && $this->input->post('movie_id') && $this->input->post('comment_text')) {

			$user_id = $this->input->post('user_id'); 
			$movie_id = $this->input->post('movie_id'); 
			$comment_text = $this->input->post('comment_text'); 

			if($this->Films_model->setComments($user_id, $movie_id, $comment_text)) {

				$this->data['title'] = 'Commentary Added!';
				$this->load->view('movies/commentCreated');
			}
		}
		else{
			$this->load->view('movies/commentError', $this->data);
		}
    }
    
}

после переустановки системы такая ошибка
0

но как обьяснить тогда такое я код вообще не трогал,эта уменя такая ошибка после переустановки системы появляется

до этого все работало

0
Message: Required parameter $limit follows optional parameter $slug

Filename: models/Films_model.php

Нужно в контроллере, при вызове модели, передавать $limit и $slug, примерно так:

$movie_slug = $this->Films_model->getFilms($slug, false, false);
0

Там же не для класса Movies ошибка, там другие контроллеры есть где вызывается эта модель, нужно во всех контроллерах поправить, где ошибку показывает:

A PHP Error was encountered
Severity: 8192

Message: Required parameter $limit follows optional parameter $slug

Filename: models/Films_model.php

Line Number: 9

Backtrace:

File: C:\xampp\htdocs\movieworld\application\core\MY_Controller.php
Line: 13
Function: model

File: C:\xampp\htdocs\movieworld\application\controllers\Main.php
Line: 8
Function: __construct

File: C:\xampp\htdocs\movieworld\index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: 8192

Message: Required parameter $limit follows optional parameter $slug

Filename: models/Serials_model.php

Line Number: 9

Backtrace:

File: C:\xampp\htdocs\movieworld\application\controllers\Main.php
Line: 18
Function: model

File: C:\xampp\htdocs\movieworld\index.php
Line: 315
Function: require_once
Sign up or Log in to write an answer