fed 发表于 2014-12-4 13:41:59

路由相关---2014 12 4

本帖最后由 fed 于 2014-12-8 11:20 编辑

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



<?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);
                        }
                }
      }?>


<!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>





Closer 发表于 2014-12-4 16:47:50

請貼你測試上傳的 控制器 與 視圖 的PHP原始碼

Closer 发表于 2014-12-19 16:43:40

這問題解決了嗎?
你有更改過,沒回覆,所以沒注意到。

页: [1]
查看完整版本: 路由相关---2014 12 4