08 2024 档案

摘要://采用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 哆啦阿梦 编辑
摘要:借鉴:https://blog.csdn.net/weixin_42541725/article/details/110674834 翻译 搜索 复制 阅读全文
posted @ 2024-08-15 22:28 哆啦阿梦 编辑
摘要:<a href="javascript:history.go(-1)">返回上一页</a> <a href="javascript:location.reload()">刷新当前页面</a> <a href="javascript:" onclick="history.go(-2); ">返回前两页 阅读全文
posted @ 2024-08-11 16:51 哆啦阿梦 编辑
摘要:安装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 哆啦阿梦 编辑
摘要:一、默认环境下使用service 1、找到app\config\services.php,在里面添加方法函数。 <?php namespace Config; use CodeIgniter\Config\BaseService; class Services extends BaseService 阅读全文
posted @ 2024-08-02 15:21 哆啦阿梦 编辑
摘要:// 方法一: use App\Controllers\Pages; $routes->get('pages', [Pages::class, 'index']); $routes->get('(:segment)', [Pages::class, 'view']); // 方法二: $routes 阅读全文
posted @ 2024-08-01 15:57 哆啦阿梦 编辑

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