[英]URL on CodeIgniter 3 ? newbie need help for tutorial
I am new to CodeIgniter 3, I am trying to create a static page from this tutorial https://codeigniter.com/userguide3/tutorial/static_pages.html I am new to CodeIgniter 3, I am trying to create a static page from this tutorial https://codeigniter.com/userguide3/tutorial/static_pages.html
http://localhost/index.php/pages/view It is work. http://localhost/index.php/pages/view 这是工作。
but my actual is like this C:\xampp\htdocs\application\views\pages?但我的实际情况是这样的 C:\xampp\htdocs\application\views\pages? (and not work)
(不工作)
why the folder is not /views/pages?为什么文件夹不是/views/pages?
I am getting confuse.我越来越糊涂了。
Also need help, i am new to codeIgniter 3, I want to create a simple form, but they not work in the views也需要帮助,我是 codeIgniter 3 的新手,我想创建一个简单的表单,但它们在视图中不起作用
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
welcome.php欢迎。php
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
both added the controllers都添加了控制器
class Welcome extends CI_Controller {
public function index()
{
$this->load->view('welcome');
}
}
class Form extends CI_Controller {
public function index()
{
$this->load->view('form');
}
}
I tried these, but they not work.我试过这些,但它们不起作用。
You have not mentioned form action correctly.您没有正确提及表单操作。 The form action should be look like this
表单动作应该是这样的
action="<?php echo base_url(); ?>form
" action="<?php echo base_url(); ?>form
"
and in the route.php
add route for your action.并在
route.php
中为您的操作添加路线。
Example:例子:
$route['form'] = 'form/index';
Then you can have $_POST
values in your Form controller.然后您可以在表格 controller 中包含
$_POST
值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.