Alex wood
Alex wood

Reputation: 163

Codeigniter error : define() expects at least 2 parameters

I got a strange error in Codeigniter error : define() expects at least 2 parameters in Line 1.

What is wrong with my code below

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

class Login extends CI_controller {

    function __construct(){
        parent::__construct();
    }

    public function index(){
        $this->load->view('login_view');
    }
}

Upvotes: 0

Views: 2156

Answers (2)

Praveenkumar
Praveenkumar

Reputation: 1

Try this may be it works:

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

Upvotes: 0

Rizier123
Rizier123

Reputation: 59701

I think your looking for the function: defined()

With define() your defining a constant!

With defined() your checking if a constant is defined!

So try this:

!defined('BASEPATH')

Upvotes: 2

Related Questions