php – 使用CodeIgniter http:// :: 1 / codeigniter / in html
我在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中
> http:// :: 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 /’; 并且总是好的结束url与/ 您可能需要在此处为??您的表单创建路线 application > config > routes.php CodeIgniter 3:Routing CodeIgniter 2:Routing 更新:
当您创建文件时,您必须在文件名和类上具有第一个字母大写. 有时候会发生这样的情况,所有这些都可能在本地主机环境中工作较少,但是当您访问实时服务器时,会发生错误或不提交表单正确等. 示例:从Controllers这也适用于Models 这是有效的 文件名:Verifylogin.php <?php class Verifylogin extends CI_Controller { public function __construct() { parent::__construct(); } public function index() { } } 这是有效的 文件名:Verify_login.php <?php class Verify_login extends CI_Controller { public function __construct() { parent::__construct(); } public function index() { } } 这是无效的 文件名:verifylogin.php class verifylogin extends CI_Controller { public function __construct() { parent::__construct(); } public function index() { } } 这是无效的 文件名:Verify_Login.php class Verify_Login extends CI_Controller { public function __construct() { parent::__construct(); } public function index() { } } Codeigniter Doc’s (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |