用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1045|回复: 2
收起左侧

路由相关---2014 12 4

[复制链接]
发表于 2014-12-4 13:41:59 | 显示全部楼层 |阅读模式
本帖最后由 fed 于 2014-12-8 11:20 编辑

在试上传类,选好图片后,点击上传,index.php/upload...变成了   index.php?upload...   什么原因?


PHP复制代码

<?php
        class Upload extends CI_Controller
        {
                function __construct()
                {
                        parent::__construct();
                        $this->load->helper(array('form','url'));
                }
 
                public function index()
                {
                        $this->load->view('upload_form',array('error'=>''));
                }
                public function do_upload()
                {
                        $config['upload_path']        ='./uploads/';
                        $config['allowd_types']        ='gif|jpg|png';
                        $config['max_size']                ='100';
                        $config['max_width']        ='1024';
                        $config['max_height']        ='768';
 
                        $this->load->library('upload',$config);
 
                        if(! $this->upload->do_upload())
                        {
                                $error = array('error'=>$this->upload->display_errors());
 
                                $this->load->view('upload_form',$error);
                        }
                        else
                        {
                                $data = array('upload_data'=>$this->upload->data());
 
                                $this->load->view('upload_success',$data);
                        }
                }
        }[/color][color=#333333]?>
 
复制代码

PHP复制代码

<!DOCTYPE html>
<html lang="en">
<head>
        <meta charset="UTF-8">
        <title>upload</title>
</head>
<body>
        <?php echo $error; ?>
 
        <?php echo form_open_multipart('upload/do_upload'); ?>
 
        <input type="file" name="userfile" size="20"/>
 
        <br/>
 
        <input type="submit" value="上传"/>
 
        </form>
 
</body>
</html>

复制代码




发表于 2014-12-4 16:47:50 | 显示全部楼层
請貼你測試上傳的 控制器 與 視圖 的PHP原始碼
发表于 2014-12-19 16:43:40 | 显示全部楼层
這問題解決了嗎?
你有更改過,沒回覆,所以沒注意到。

本版积分规则