0

我被卡住了,似乎无法解决我的问题。我正在尝试第一次使用 Codeigniter 编写一个基本的“联系我们表格”。我认为我的表格看起来像这样..

<div style='float: left; padding-right: 55px; padding-left: 35px;'>
    <?php 
        $this->load->helper('form'); 
        echo form_open('pages/emailsender'); ?>

        Contact Us:<br />
        <?php 
        echo form_input('name', 'Enter Your Name');
        echo form_input('email', 'Enter Your Email'); 
        echo "<br />";
        echo form_textarea('message', 'Enter your message here, thanks for taking the time to contact us!');
        echo "<br />";
        echo form_submit('submit', 'Send Message!');
        echo form_reset('reset', 'Reset Form');
        echo form_close();
        ?>
</div>

我的控制器 pages.php 看起来像这样..

<?php

class Pages extends CI_Controller {

    public function index(){

        $this->load->view('templates/header');
        $this->load->view('home');
        $this->load->view('templates/footer');
    }

    public function home(){

        $this->load->view('templates/header');
        $this->load->view('home');
        $this->load->view('templates/footer');
    }

    public function about(){

        $this->load->view('templates/header');
        $this->load->view('about');
        $this->load->view('templates/footer');
    }

    public function services(){

        $this->load->view('templates/header');
        $this->load->view('services');
        $this->load->view('templates/footer');
    }

    public function reviews(){

        $this->load->view('templates/header');
        $this->load->view('reviews');
        $this->load->view('templates/footer');
    }

    public function specials(){

        $this->load->view('templates/header');
        $this->load->view('specials');
        $this->load->view('templates/footer');
    }

    public function contact(){

        $this->load->view('templates/header');
        $this->load->view('contact');
        $this->load->view('templates/footer');
    }

    public function emailsender(){
        $this->load->view('templates/header');
        $this->load->view('contact');
        $this->load->view('templates/footer');
    }

}

我有“emailsender”功能只是将我重定向回与测试相同的页面,但它甚至不会这样做?!我收到“未指定输入文件”。每次都出错。我在 stackoverflow Codeigniter 上阅读了这篇文章,没有指定输入文件错误,但它似乎并没有解决我的问题。我的配置文件看起来像这样..

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = 'http://mywebsitename.com';
$config['index_page'] = ""; 
$config['uri_protocol'] = "AUTO"; 

任何想法为什么我会收到 No input file specified 错误?

4

4 回答 4

7

改变你.htaccess的样子

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

注意?最后一行的标记。以前这条线是这样的RewriteRule ^(.*)$ index.php/$1 [L]

还要确保RewriteBase /在您的.htaccess

于 2013-10-11T21:12:11.710 回答
2

像这样改变你的 .htaccess

<IfModule mod_rewrite.c>

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

</IfModule>

希望它对你有用......谢谢

于 2014-11-18T06:51:24.203 回答
0

改变:

 echo form_open('pages/emailsender'); ?>

至:

echo form_open_multipart('pages/emailsender'); ?>

form_open_multipart添加enctype="multipart/form-data"form标签。

于 2013-10-11T21:08:14.227 回答
0

您需要使用直接链接而不是表单打开标记的简写。像这样:

echo form_open(‘http://example.com/welcome/emailsender’);

而不是这个:

echo form_open(‘welcome/emailsender’);
于 2013-10-12T02:13:30.760 回答