我已尝试操作控件/方法,但form_open
方法无效我已加载帮助器
hello.php控制器
<?php
class hello extends CI_Controller {
public function index() {
$this->load->helper('form');
$this->load->view("fv");
}
public function f_validation() {
echo "hello";
}
}
?>
fv.php 查看文件
<html>
<head>
<title>My Form</title>
</head>
<body>
<?php echo form_open('hello/f_validation'); ?>
<h5>Username</h5>
<input type="text" name="username" value="">
<h5>Password</h5>
<input type="text" name="password" value="" >
<h5>Password Confirm</h5>
<input type="text" name="passconf" value="" >
<h5>Email Address</h5>
<input type="text" name="email" value="" >
<div><input type="submit" value="Submit" /></div>
</form>
</body>
</html>
答案 0 :(得分:2)
像这样使用
<?php
class Hello extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->helper('form');
}
public function index()
{
$this->load->view("fv");
}
public function f_validation()
{
echo "hello";
}
}
请参阅:
https://www.codeigniter.com/user_guide/general/controllers.html
https://www.codeigniter.com/user_guide/general/helpers.html#loading-a-helper