Reputation: 1
I am a new user of CodeIgniter. First I install CodeIgniter, then wrote the following code and try to run it with the help of my browser. I save the program in htdocs/application/controllers/hello.php
but it shows the error:
Warning: define() expects at least 2 parameters, 1 given in D:\xampp\htdocs\ci_intro\hello.php on line 2
No direct script access is allowed.
What is the problem?
<?php
if(!define('BASEPATH','')) exit('no direct script access allowed');
class Hello extends CI_Controller{
public function index()
{
echo "this is my index function";
}
public function one()
{
$this->load->view('one');
}
}
?>
Upvotes: 0
Views: 266
Reputation: 7895
It should be defined
not define
.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Upvotes: 4