0

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');
    }
}
?>
2
  • Sorry,it gives the above warning Commented Jan 7, 2014 at 19:16
  • Please take the time to use the formatting tools in your questions so they are readable, like it is now. Also, add at least some of your question prior to your code - starting with code and no context can be a bit confusing for readers. Commented Jan 7, 2014 at 22:55

1 Answer 1

4

It should be defined not define.

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.