我在Xampp上安装了CI脚本.目前我正在处理表单,当我点击html上的提交时,它什么都不做.
我试过了
echo form_open('verifylogin'); echo form_open();
<form action="http://::1/codeigniter/verifylogin"> <form action="http://::1/codeigniter/">
分别.
我不明白这个“http:// :: 1 /”是什么,如何摆脱它?
如果ip地址显示在表单action或url中
原文链接:https://www.f2er.com/php/131349.html> 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留空.
> $config [‘base_url’] =’http:// localhost / yourproject /’;
> $config [‘base_url’] =’http://www.example.com/’;
并且总是好的结束url与/
您可能需要在此处为您的表单创建路线
application > config > routes.PHP
CodeIgniter 3:Routing
CodeIgniter 2:Routing
更新:
With CodeIgniter 3 + versions:
有时候会发生这样的情况,所有这些都可能在本地主机环境中工作较少,但是当您访问实时服务器时,会发生错误或不提交表单正确等.
示例:从Controllers这也适用于Models
这是有效的
<?PHP class Verifylogin extends CI_Controller { public function __construct() { parent::__construct(); } public function index() { } }
这是有效的
<?PHP class Verify_login extends CI_Controller { public function __construct() { parent::__construct(); } public function index() { } }
这是无效的
class verifylogin extends CI_Controller { public function __construct() { parent::__construct(); } public function index() { } }
这是无效的
class Verify_Login extends CI_Controller { public function __construct() { parent::__construct(); } public function index() { } }
Codeigniter Doc’s