|
发表于 2010-9-15 16:40:25
|
显示全部楼层
这个问题我把input扩展了一下,还是一样要指定接收哪个字段,只是POST可以传入数组,大家给点意见:
PHP复制代码
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Input extends CI_Input {
/**
* Fetch items from the GET array
*
* @access public
* @param mixed
* @param bool
* @return string
*/
function get ($index = '', $xss_clean = FALSE)
{
if(is_array($index))
{
$rt = array();
foreach ($index as $key)
$rt[$key] = $this->_fetch_from_array ($_GET, $key, $xss_clean);
return $rt;
}
else
return $this->_fetch_from_array ($_GET, $index, $xss_clean);
}
// --------------------------------------------------------------------
/**
* Fetch items from the POST array
*
* @access public
* @param mixed
* @param bool
* @return string
*/
function post ($index = '', $xss_clean = FALSE)
{
if(is_array($index))
{
$rt = array();
foreach ($index as $key)
$rt[$key] = $this->_fetch_from_array ($_POST, $key, $xss_clean);
return $rt;
}
else
return $this->_fetch_from_array ($_POST, $index, $xss_clean);
}
}
复制代码 |
评分
-
查看全部评分
|