0
Codeigniter 2.1의 양식을 사용하여 컨트롤러에 액세스 할 수 없습니다. 홈페이지에 여러 링크가 있으며 액세스 할 수 있습니다. 그러나 폼에 데이터를 서브 마디로 표시하려면 403 금지 된 오류가 표시됩니다.오류 403 : 금지 된 오류
금지됨이 서버에서 /Pluebas/application/controllers/valiar.php에 액세스 할 수있는 권한이 없습니다.
뷰 :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Anuncios</title>
<link rel="stylesheet" href="/Pruebas/css/estilos.css" type="text/css"
media="screen"/>
<link rel="stylesheet" href="/Pruebas/css/logestilos.css" type="text/css"
media="screen"/>
</head>
<body>
<div id="contenedor">
<div id="menu">
<label for="home" id="inicio"><a href="http://localhost/Pruebas/index.php
/cindice/">Inicio</a></label>
<label for="acceso" id="login"><a href="http://localhost/Pruebas/index.php
/cindice/publicar">Publicar anuncio</a></label>
<label for="reg" id="registro"><a href="http://localhost/Pruebas/index.php
/cindice/registro">Registro</a></label>
<label for="empresa" id="sobrempresa"><a href="http://localhost/Pruebas
/index.php/cindice/sobempresa">Sobre nosotros</a></label>
<label for="contacto" id="contactar"><a href="http://localhost/Pruebas
/index.php/cindice/contacto">Contáctanos</a></label>
</div>
</div>
<div id="acformulario">
<?php echo validation_errors(); ?>
<form action="http://localhost/Pruebas/application/controllers
/validar.php" method="post">
<label for="correo" id="dcorreo">Dirección de correo</label>
<input type="text" name="drcorreo" id="dcc"/><br /><br />
<label for="contrasenya" id="cont">Contraseña</label>
<input type="password" name="contrasena" id="cmcont"/><br /><br />
<input type="submit" name="envia" id="bentrar" value="Entrar" />
</form>
</div>
</body>
</html>
컨트롤러 :
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Cindice extends CI_Controller {
function __construct() {
parent::__construct();
}
public function index()
{
$this->load->view('indice');
}
public function validar()
{
$this->input->post('drcorreo');
$this->input->post('contrasena');
$this->form_validation->set_rules('correo','Dirección de
correo','trim|required|valid_email|xss_clean');
$this->form_validation->set_rules('contrasenya','Contraseña',
'trim|required|md5|xss_clean');
if ($this->form_validation->run())
{
echo ("validación válida");
}
else {
$this->load->view('');
echo ("validación incorrecta");
}
}
내 .htacess 파일이 단어 모두에서 거부있다. 컨트롤러에 어떻게 접근 할 수 있습니까?
감사합니다.
php echo form_open ('cindice/validar') - 단지 안전합니다. –
그의 코드가 약간 명확하지 않습니다. 그는'validar.php' 컨트롤러를 갖고있는 것 같지만,'validar' 메소드를 가진 컨트롤러'cindice.php'도 가지고 있습니다. 그의 설정에 달려 있습니다. 그렇지만 잘 잡을 수 있습니다. – Mudshark
올바른 ... 위의 제공된 코드 에서처럼 양식을 cindice/validar에 제출해야합니다. 그가 CI에 익숙하지 않고 MVC 패턴을 오용하고 있다고 생각합니다. –