随笔分类 -  CodeIgniter

摘要:创建yy类 class yy extends CI_Controller { public function __construct() { parent::__construct(); } public function fy() { echo 'home/yy'; } public functi 阅读全文
posted @ 2024-09-06 09:30 哆啦阿梦 编辑
摘要:当ci3使用PHP8.2,出现问题 An uncaught Exception was encountered Type: Error Message: Call to undefined function mysqli_init() Filename: D:\www\ci3\system\data 阅读全文
posted @ 2024-09-03 08:58 哆啦阿梦 编辑
摘要://采用PDO连接数据库,只能捕获PDO连接数据库的错误,codeigniter自身无法捕获异常function show() { // $pdo = $this->db->connect(); //建立对数据库的连接。 $pdo = $this->db->db_pconnect(true); // 阅读全文
posted @ 2024-08-29 16:38 哆啦阿梦 编辑
摘要:$db['default'] = array( 'dsn' => "mysql:host=localhost;dbname=test;charset=utf8",//设置数据库连接字符串 'hostname' => 'localhost', 'username' => 'root', 'passwo 阅读全文
posted @ 2024-08-29 16:09 哆啦阿梦 编辑
摘要:1、创建类文件 2、构造函数中使用数组形参,接收传递参数 class Hehe { // public function __construct($config = array()) { p($config); } // // public function index() { // } funct 阅读全文
posted @ 2024-08-28 15:02 哆啦阿梦 编辑
摘要:function ddd() { try { $db = db_connect(); //创建数据库连接 $rs = $db->table('news t1')->get()->getResult(); //查询(查询结束后,不会重置数据库连接,后面的内容依然会继续执行) $data['title' 阅读全文
posted @ 2024-08-27 15:35 哆啦阿梦 编辑
摘要:安装Codeigniter 4.5.4,报错 The framework needs the following extension(s) installed and loaded: intl, mbstring. //意思是需要安装intl,mbstring 解决方法: 必须PHP8.1版本以上 阅读全文
posted @ 2024-08-09 21:23 哆啦阿梦 编辑
摘要:Session类 清除template类型session 1、template类型 $ci->session->unset_tempdata('uu'); //如果想在相同的请求中重用这个值,你可以使用,也就是说,虽然删除了session,但还是能够取到里面的值 $this->session->un 阅读全文
posted @ 2024-08-06 08:31 哆啦阿梦 编辑
摘要:加载驱动器时,报错: Unable to locate the specified class: Cates.php 通过筛查发现,是因为有个驱动器类名和控制名重名导致 $autoload['drivers'] = array('cates', 'daoru', 'up', 'weixin', 'c 阅读全文
posted @ 2024-07-31 15:55 哆啦阿梦 编辑
摘要:引入: https://blog.csdn.net/weixin_45092437/article/details/129752333 翻译 搜索 复制 阅读全文
posted @ 2024-07-27 14:42 哆啦阿梦 编辑
摘要:加载器类 加载器,顾名思义,是用于加载元素的,加载的元素可以是库(类),视图文件 , 驱动器 ,辅助函数 , 模型 或其他你自己的文件。 应用程序包 目录结构 /application/third_party/foo_bar //文件夹可选 config/ helpers/ language/ li 阅读全文
posted @ 2024-07-25 11:18 哆啦阿梦 编辑
摘要:一、创建文件和目录结构 /application/libraries/Driver_name Driver_name.php //为了在大小写敏感的文件系统下保证兼容性,Driver_name 目录必须以 ucfirst() 函数返回的结果格式进行命名。 drivers Driver_name_su 阅读全文
posted @ 2024-07-05 10:36 哆啦阿梦 编辑
摘要:set() 方法也接受可选的第三个参数($escape),如果设置为 FALSE,数据将不会自动转义。为了说明两者之间的区别,这里有一个带转义的 set() 方法和不带转义的例子。 $this->db->set('field', 'field+1', FALSE); $this->db->where 阅读全文
posted @ 2024-07-01 15:01 哆啦阿梦 编辑
摘要:1、创建块函数 function smarty_block_b_info($arr, $content, $repeat) { if ($repeat) { $ci = &get_instance(); $res = $ci->db->get('val', $arr['limit'])->resul 阅读全文
posted @ 2024-05-31 22:47 哆啦阿梦 编辑
摘要:开启缓存 将下面的代码放到任何一个控制器的方法内,你就可以开启缓存了: $this->output->cache($n); 其中 $n 是缓存更新的时间(单位分钟)。 上面的代码可以放在方法的任何位置,它出现的顺序对缓存没有影响, 所以你可以把它放到任何你认为合理的地方。一旦该代码被放在方法内, 你 阅读全文
posted @ 2024-05-29 09:03 哆啦阿梦 编辑
摘要:1、设置为autoload自动加载,则需要初始化 $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'mp4|avi|mpeg|mov|flv|rmvb'; $config['max_size'] = 204800; 阅读全文
posted @ 2024-04-25 16:57 哆啦阿梦 编辑
摘要:环境:使用Smarty-3.1.14 报错:The each() function is deprecated. This message will be suppressed on further calls 问题:因为php7.2之后,each()方法被废除,倒退php版本即可 翻译 搜索 复制 阅读全文
posted @ 2024-03-30 20:06 哆啦阿梦 编辑
摘要:同一连接多个数据库切换,db_select($database_name) $this->db->db_select('aaa'); $res = $this->db->get('z_attr')->result_array(); insert_batch() insert_batch($table 阅读全文
posted @ 2024-03-28 17:30 哆啦阿梦 编辑
摘要:/* | | Cache Directory Path | | | Leave this BLANK unless you would like to set something other than the default | application/cache/ directory. Use a 阅读全文
posted @ 2024-03-01 15:45 哆啦阿梦 编辑
摘要:public function charu() { $rs = $this->ci->input->get('val'); $rds = new Redis(); $rds->connect('127.0.0.1', 6380); $rds->lpush('lst', $rs); } functio 阅读全文
posted @ 2023-12-24 18:17 哆啦阿梦 编辑

点击右上角即可分享
微信分享提示