【发布时间】:2014-05-12 12:32:17
【问题描述】:
尝试在 Codeigniter 内的 cURl 写入函数中使用 memcached 时出现错误。
curl_setopt($ch, CURLOPT_WRITEFUNCTION, function($ch, $str)
{ //print(htmlentities($str)."\n\n");
$ci &= get_instance();
$ci->cache->memcached->save('foo', 'bar', 600); return strlen($str);
});
错误是
Message: Undefined variable: ci
Message: Object of class admin_test could not be converted to int
有什么建议吗?
我尝试了来自此链接CodeIgniter: can't access $this within function in view 的建议 从这里开始: Object of class stdClass could not be converted to string
我可以使用 $ci 语法来进行这样的数据库查询
$ci->db->query('SELECT * FROM TABLE');
但不是使用 memcached。
【问题讨论】:
标签: php codeigniter curl memcached