私はwebsite_checkという関数を持っています
function website_check($url){
if ($url !=""){
if (preg_match("#^https?://.+#", $url) and fopen($url,"r")){
return TRUE;
}else{
$this->form_validation->set_message('Website url', 'The %s field is invalid');
return FALSE;
}
}else{
$this->form_validation->set_message('Website url', 'The %s field is required');
return FALSE;
}
}
そして私はこの関数をカスタムコードイグナイターフォーム検証関数として使用します
$this->form_validation->set_rules('website', 'Website', 'callback_website_check');
私はすべてのコントローラーでこの関数を使用しているので、この関数をcodeignitersフォーム検証クラスに追加し、デフォルトの検証関数として使用したいと思います。関数をcodeignitersフォーム検証クラスに追加することは可能ですか?