1
私はカスタム404コントローラを持っています。それはうまく動作します。 routes.phpの中で私が持っている:codeigniterカスタムを強制する404
$route['404_override'] = 'custom404';
これは、このコントローラにアクセスします。
class custom404 extends MasterController {
public function __construct(){
parent::__construct();
}
public function index(){
$this->output->set_status_header('404');
$crit = array(
'subtype' => 'footer',
'status' => 'public'
);
$res = $this->mongo_db->where($crit)->get('contentobjects');
$this->pagedata = $res[0];
$this->load->view('404');
}
}
は、私は別のコントローラからこれを呼び出すことができますか? は現在、私はちょうど(表向き) - 現存決してページを呼び出すことによって、問題を強制しています:
if(!$this->viewable($res[0])){
header('Location: /404');
die;
}
のようにこれは私のカスタム404ビューなしで、404をスローし、あなたが必要とする任意のコードを設定することができます。 – axlotl
デフォルトのエラービューフォルダにあるエラーテンプレートをカスタマイズできます。 – PaulD