Cod*_*ner 11 php xampp codeigniter
我在Xampp上安装了CI脚本.目前我正在处理表单,当我点击提交html时,它什么也没做.
我试过了
echo form_open('verifylogin');
echo form_open();
Run Code Online (Sandbox Code Playgroud)
它在源代码上显示为
<form action="http://::1/codeigniter/verifylogin">
<form action="http://::1/codeigniter/">
Run Code Online (Sandbox Code Playgroud)
分别.
我不明白这"http://::1/"是什么以及如何摆脱它?
Mr.*_* ED 28
如果ip地址显示在表单操作或URL中
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'] = '';
Run Code Online (Sandbox Code Playgroud)
现在,在最新版本的codeIgniter中,不建议您将base_url留空.
$config['base_url'] = 'http://localhost/yourproject/';$config['base_url'] = 'http://www.example.com/';结束网址总是好的 /
您可能需要在此处为表单创建路线
application > config > routes.php
Run Code Online (Sandbox Code Playgroud)
CodeIgniter 3: 路由
CodeIgniter 2: 路由
更新:
使用CodeIgniter 3 +版本:
当你创建一个文件时,你必须在第一个字母上打上大写字母file names和classes.
有时会发生的事情是,它可能在小型的localhost环境中工作,但是当你去实时服务器时,有时会抛出错误或者不提交表单正确等.
文件名: Verifylogin.php
<?php
class Verifylogin extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
}
}
Run Code Online (Sandbox Code Playgroud)
文件名: Verify_login.php
<?php
class Verify_login extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
}
}
Run Code Online (Sandbox Code Playgroud)
文件名: verifylogin.php
class verifylogin extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
}
}
Run Code Online (Sandbox Code Playgroud)
文件名: Verify_Login.php
class Verify_Login extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
}
}
Run Code Online (Sandbox Code Playgroud)
Codeigniter Doc's
转到application/config/config.php set base_url
$config['base_url'] = 'http://localhost/example/';
并刷新您的应用程序
然后::1错误应该消失.
| 归档时间: |
|
| 查看次数: |
15339 次 |
| 最近记录: |