タイトルがバカっぽい。しかし、私は問題に遭遇しました。今はhttp://ci.tao2tw.comと入力するだけで、 index.php/entry 関数にルーティングできますが、 http://ci.tao2tw.com/order と入力すると、ルーティングしたいです別のコントローラ order.php に、しかし、それは動作しません! 私の設定に何か問題がありますか??
今、 http://ci.tao2tw.com/order/testで注文コントローラーの下でテスト機能を実行できません 。代わりに、htpp://ci.tao2tw.com/ index.php /order/testと入力する必要があります。
よろしくお願いします〜
routes.php で
$route['default_controller'] = "index/entry";
$route['order'] = "order";
$route['404_override'] = '';
config.php で
$config['base_url'] = 'http://ci.tao2tw.com/';
$config['index_page'] = '';
controller/index.php で (正常に動作します)
class Index extends CI_Controller {
public function __construct() // to remember use public
{
parent::__construct();
$this->load->helper('url');
//anchor();
}
public function entry() //just show index
{
$this->load->view('index_view',$data);
}
}
controller/order.php で (作業なし)
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Order extends CI_Controller {
public function __construct() // to remember use public
{
parent::__construct();
$this->load->helper('url');
}
public function fill($action) // 顯示填寫表單
{
echo "test";
}
//http://codeigniter.com/user_guide/libraries/uri.html
public function order($action)
{
echo $action;
}
}
?>
.htaccess ファイル
RewriteEngine on
RewriteCond $1 !^(index\.php|css|flash|images|img|includes|js|language|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
~