【发布时间】:2015-12-14 20:49:14
【问题描述】:
我有一个 codeigniter 控制器,它有一个索引页面,它接受 4 个参数,如以下参数:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Upload extends CI_Controller {
public function index($file_name = NULL, $PID = NULL, $Email = NULL, $password = NULL){
if($file_name === NULL){
$this->output
->set_content_type('application/json')
->set_output(json_encode(array("status"=> "failure", "message" => "The file name is missing")));
}else if($PID === NULL){
$this->output
->set_content_type('application/json')
->set_output(json_encode(array("status"=> "failure", "message" => "The PID is missing")));
}else if($Email === NULL){
$this->output
->set_content_type('application/json')
->set_output(json_encode(array("status"=> "failure", "message" => "The email is missing")));
}else if($password === NULL){
$this->output
->set_content_type('application/json')
->set_output(json_encode(array("status"=> "failure", "message" => "The password is missing")));
}else{
$this->output
->set_content_type('application/json')
->set_output(json_encode(array("status"=> "success", "message" => "Upload Done")));
}
}
}
route.php 文件看起来像:
$route['Upload/(:any)'] = "Upload/index/$1";
$route['Upload/(:any)/(:any)'] = "Upload/index/$1/$2";
$route['Upload/(:any)/(:any)/(:any)'] = "Upload/index/$1/$2/$3";
$route['Upload/(:any)/(:any)/(:any)/(:any)'] = "Upload/index/$1/$2/$3/$4";
我想调用 Controller 索引方法并提供所有数据,如下所示:
www.mysite.com/Upload/myfile.csv/367/myemail@gmail.com/mypass;23!ù/o*
如果我这样运行,我会得到:
遇到错误
您提交的 URI 包含不允许的字符。
加密每个数据并将它们全部发送到上述 URL 中的最佳方法是什么?
我试过base64但同样的问题,请问有什么想法吗?
谢谢
【问题讨论】:
标签: php codeigniter url