2014-01-07 118 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');