我正在IIS 8.5服务器上设置一个新的codeigniter 3应用程序。加载默认控制器和索引函数时工作正常,但在调用任何其他函数后,它只是重新加载默认控制器索引函数。
这是我的Web配置文件
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true" />
<rewrite>
<rules>
<rule name="RuleRemoveIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<directoryBrowse enabled="false" />
<defaultDocument>
<files>
<add value="index.php"/>
</files>
</defaultDocument>
<handlers>
<add name="PHP-phtml" path="*.phtml" verb="*" modules="CgiModule" scriptProcessor="C:\Program Files (x86)\Plesk\Additional\PleskPHP70\php-cgi.exe" resourceType="File" />
<add name="PHP-php3" path="*.php3" verb="*" modules="CgiModule" scriptProcessor="C:\Program Files (x86)\Plesk\Additional\PleskPHP70\php-cgi.exe" resourceType="File" />
<add name="PHP-php" path="*.php" verb="*" modules="CgiModule" scriptProcessor="C:\Program Files (x86)\Plesk\Additional\PleskPHP70\php-cgi.exe" resourceType="File" />
</handlers>
</system.webServer>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
</system.web>
</configuration>
控制器
class Login extends CI_Controller {
public function index() {
$this->load->view('employee_login');
}
public function emp_login_check() {
print_r("hello");
}
}
登录是我的默认控制器。employee_login页面加载正常,当我尝试从employee_login页面调用emp_login_check时,它只是再次重新加载employee_login页面。
employee_login页面
<html>
<form class="m-t" role="form" action="<?php echo base_url('Login/emp_login_check'); ?>" method="post">
<button type="submit">Login</button>
</form>
</html>
能不能帮我一下,为什么不调用emp_login_check函数?我是iis服务器的新手。
发布于 2019-07-26 15:20:42
您需要检查什么是站点绑定和站点配置设置。
站点绑定:
控制器: Login.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Login extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->helper('url');
}
public function index()
{
$this->load->view('employee_login');
}
public function emp_login_check()
{
print_r("hello");
exit;
}
}
查看: employee_login.php
<html>
<form class="m-t" role="form" action="<?php echo base_url('Login/emp_login_check'); ?>" method="post">
<button type="submit">Login</button>
</form>
</html>
Config.php:
$config['base_url'] = 'http://localhost:8066/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
URL重写规则:
<rule name="RuleRemoveIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
https://stackoverflow.com/questions/57204588
复制相似问题