IP 地址在 HTML 源代码中使用 CodeIgniter http://::1/codeigniter/以表单操作显示

IP address is showing in form action with CodeIgniter http://::1/codeigniter/ in html sourcecode(IP 地址在 HTML 源代码中使用 CodeIgniter http://::1/codeigniter/以表单操作显示)
本文介绍了IP 地址在 HTML 源代码中使用 CodeIgniter http://::1/codeigniter/以表单操作显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Xampp 上安装了 CI 脚本.目前我正在处理表单,当我点击 html 上的提交时,它什么也不做.

I have the CI script installed on Xampp. Currently I am working on forms and when I click on submit on html, it does nothing.

我试过了

echo form_open('verifylogin');
echo form_open();

它在源代码中显示为

<form action="http://::1/codeigniter/verifylogin">
<form action="http://::1/codeigniter/">

分别.

我不明白这个 "http://::1/" 是什么以及如何摆脱它?

I don't understand what this "http://::1/" is and how to get rid of it?

推荐答案

如果ip地址显示在form actionurl

  • http://::1/yourproject/
  • http://127.0.0.1/yourproject/

您可能将基本网址留空

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/

$config['base_url'] = '';

现在在最新版本的 codeIgniter 中,不建议您将 base_url 留空.

Now days in latest versions of codeIgniter it is not recommend that you leave your base_url blank.

  • $config['base_url'] = 'http://localhost/yourproject/';
  • $config['base_url'] = 'http://www.example.com/';

/

您可能需要在此处为​​您的表单创建路由

You may need to create routes for your form here

application > config > routes.php

CodeIgniter 3: 路由

CodeIgniter 2: 路由

更新:

使用 CodeIgniter 3 + 版本:

With CodeIgniter 3 + versions:

当您创建文件时,请记住您必须在 file namesclasses 上使用仅第一个字母大写.

When you create a file remember you will have to have first letter ONLY upper case on file names and classes.

有时会发生的情况是,这一切都可以在 localhost 环境中以小写字母运行,但是当您转到实时服务器时有时会抛出错误或提交表单不正确等.

What will happen sometimes is that it all may well work in a localhost environment with lower case but when you go to a live server some times will throw errors or not submit forms correct etc.

示例:来自 控制器 这也适用于 模型

Example: From Controllers This also applies to Models

文件名:验证登录.php

<?php

class Verifylogin extends CI_Controller {

    public function __construct() {
       parent::__construct();
    }

    public function index() {

    }

}

<小时>

这是有效的

文件名:Verify_login.php


This is valid

File name: Verify_login.php

<?php

class Verify_login extends CI_Controller {

    public function __construct() {
       parent::__construct();
    }

    public function index() {

    }

}

<小时>

无效有效

文件名: verifylogin.php


This is not valid

File name: verifylogin.php

class verifylogin extends CI_Controller {

    public function __construct() {
       parent::__construct();
    }

    public function index() {

    }

}

<小时>

无效有效

文件名:Verify_Login.php


This is not valid

File name: Verify_Login.php

class Verify_Login extends CI_Controller {

    public function __construct() {
       parent::__construct();
    }

    public function index() {

    }

}

Codeigniter 文档

Codeigniter Doc's

这篇关于IP 地址在 HTML 源代码中使用 CodeIgniter http://::1/codeigniter/以表单操作显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)