我已经阅读了有关该主题的每一篇帖子,似乎没有任何帮助。它曾经在以前的主机上工作,现在不在此新主机上工作。我觉得这可能是.htaccess问题。该网站位于其自己的子域中。 http://test.domain.com
routes.php:
$route['default_controller'] = "calculator";
$route['404_override'] = '';
某些形式:
<form action="index.php/calculator/calculate" method="post" id="calc_form" enctype="multipart/form-data;charset=utf-8">
<input name="span_length_ft" id="span_length_ft" type="text"/>ft
<input name="span_length_in" id="span_length_in" type="text"/>Inch
controllers / calculator.php
class Calculator extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('products_model');
$this->load->helper('form');
}
public function index(){
$deck_filters = $this->products_model->get_filters(FILTER_TYPE_DECK);
$sup_att_filters = $this->products_model->get_filters(FILTER_TYPE_SUP_ATT);
$side_att_filters = $this->products_model->get_filters(FILTER_TYPE_SIDE_ATT);
$gage_filters = $this->products_model->get_gages();
$sup_pattern_filters = $this->products_model->get_distinct_sup_patterns();
$side_spacing_filters = $this->products_model->get_distinct_side_spacings();
$thick_filters = array(
1 => '< 1/8"',
2 => '1/8"',
3 => '3/16"',
4 => '1/4"',
5 => '5/16"',
6 => '3/8"',
7 => '> 3/8"'
);
$this->load->view('header');
$this->load->view('calculator',array(
'deck_filters' => $deck_filters,
'sup_att_filters' => $sup_att_filters,
'side_att_filters' => $side_att_filters,
'gage_filters' => $gage_filters,
'sup_pattern_filters' => $sup_pattern_filters,
'side_spacing_filters' => $side_spacing_filters,
'thick_filters' => $thick_filters
));
$this->load->view('footer');
}
public function calculate(){
$this->load->library('form_validation');
$this->load->model('products_model');
$this->load->helper(array('form','url'));
$this->output->set_header("Pragma: no-cache");
var_dump($this->input->post());
var_dump($_POST);
if($this->_val_params()){
$span_length_ft = $this->input->post('span_length_ft',TRUE);
$span_length_in = $this->input->post('span_length_in',TRUE);
$nr_spans = $this->input->post('nr_spans',TRUE);
$req_shear = $this->input->post('req_shear',TRUE);
$max_flex = $this->input->post('max_flex',TRUE);
$req_vload = $this->input->post('req_vload',TRUE);
$labor_rate = $this->input->post('labor_rate',TRUE);
etc.. etc..
}
private function _val_params(){
$rules = array(
array(
'field' => 'span_length_ft',
'label' => 'Span Length (ft)',
'rules' => 'trim|xss_clean|required|integer|callback_check_span_length'
),
array(
'field' => 'span_length_in',
'label' => 'Span Length (In)',
'rules' => 'trim|xss_clean|integer'
),
array(
'field' => 'nr_spans',
'label' => 'Number of Spans',
'rules' => 'trim|xss_clean|required|integer'
),
array(
'field' => 'req_shear',
'label' => 'Required Diaphragm Shear',
'rules' => 'trim|xss_clean|required|numeric'
),
array(
'field' => 'max_flex',
'label' => 'Maximum Flexibility Factor',
'rules' => 'trim|xss_clean|numeric'
),
array(
'field' => 'req_vload',
'label' => 'Maximum Flexibility Factor',
'rules' => 'trim|xss_clean|numeric'
),
array(
'field' => 'labor_rate',
'label' => 'Labor Rate',
'rules' => 'trim|xss_clean|required|numeric'
),
array(
'field' => 'filter_deck[]',
'label' => 'Deck filter',
'rules' => 'trim|xss_clean|integer'
),
array(
'field' => 'filter_gage[]',
'label' => 'Gage filter',
'rules' => 'trim|xss_clean|integer'
),
array(
'field' => 'filter_sup_att[]',
'label' => 'Support Attachment filter',
'rules' => 'trim|xss_clean|integer'
),
array(
'field' => 'filter_sup_pattern[]',
'label' => 'Support Attachment Pattern filter',
'rules' => 'trim|xss_clean|max_length[5]'
),
array(
'field' => 'filter_thick[]',
'label' => 'Support Thickness filter',
'rules' => 'trim|xss_clean|integer'
),
array(
'field' => 'filter_side_att[]',
'label' => 'Sidelap Attachment filter',
'rules' => 'trim|xss_clean|integer'
),
array(
'field' => 'filter_side_spacing[]',
'label' => 'Sidelap Attachment Spacing filter',
'rules' => 'trim|xss_clean|integer'
)
);
$this->form_validation->set_rules($rules);
return $this->form_validation->run();
}
.htaccess:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]