2014-01-07 115 views
0

我是CodeIgniter的新用户。首先我安装CodeIgniter,然后编写下面的代码,并尝试在浏览器的帮助下运行它。我保存htdocs/application/controllers/hello.php的程序,但它显示了错误:CodeIgniter错误解决

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.

问题是什么?

<?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'); 
    } 
} 
?> 
+0

对不起,它给出了上述警告 – user2341950

+0

请花时间在您的问题中使用格式工具,以便它们可读,就像现在一样。另外,在代码之前添加至少一些你的问题 - 从代码开始,没有上下文可能会让读者感到困惑。 – halfer

回答

4

应该defineddefine

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