我正在尝试在我的pre_controller挂钩中加载cookie帮助器,以便在我们的站点上使用"记住我"功能.我认为使用$ ci =&get_instance()创建CI对象的实例; 允许我访问加载助手,但事实并非如此.
思考?
$ci =& get_instance();
$ci->load->helper('cookie');
// does not load
Run Code Online (Sandbox Code Playgroud) 我正在寻找一个URL并跟踪它经历的每个URL.出于某种原因,如果不执行不理想的递归cURL调用,我无法完成此操作.也许我错过了一些简单的选择.思考?
$url = "some url with redirects";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1) Gecko/20061024 BonEcho/2.0");
$html = curl_exec($ch);
$info = array();
if(!curl_errno($ch))
{
$info = curl_getinfo($ch);
echo "<pre>";
print_r($info);
echo "</pre>";
}
Run Code Online (Sandbox Code Playgroud)
我收到这样的回复
Array
(
[url] => THE LAST URL THAT WAS HIT
[content_type] => text/html; charset=utf-8
[http_code] => 200
[header_size] => 1942
[request_size] …Run Code Online (Sandbox Code Playgroud) 有没有比这更简单的方法
foreach($_POST as $x=>$y){
$arr[$x] = $this->input->get_post($y, TRUE);
}
Run Code Online (Sandbox Code Playgroud)
用CI的XSS过滤器清理整个$ _POST数组.看看输入库似乎get_post()只接受一个单独的变量,而不是能够清理整个数组然后返回数组.