kubi / cisetup
CodeIgniter 3 安装设置
1.2.1
2020-04-17 16:17 UTC
Requires
- php: >=5.3.7
Requires (Dev)
- mikey179/vfsstream: 1.1.*
- phpunit/phpunit: 4.* || 5.*
Suggests
- paragonie/random_compat: Provides better randomness in PHP 5.x
This package is auto-updated.
Last update: 2024-09-18 01:21:22 UTC
README
这是一个经过修改并添加了新功能的 CodeIgniter 3 框架,例如 dotenv、Sweet Alert 2 和 Bootstrap 4 等。
安装
使用 composer 安装 cisetup。
composer create-project kubi/cisetup
更新依赖。
composer install
在 .env 中设置您的 dotenv 文件
APP_URL=https:///Kubi_codes/cisetup/ APP_TIMEZONE=Asia/Jakarta DB_HOST=localhost DB_USERNAME=root DB_PASSWORD= DB_DATABASE= DB_DRIVER=mysqli
一些附加功能
XSS 回声过滤器
<?php echos($foobar); ?>
资产 URL
<img src="<?= asset_url() . 'img/foobar.png' ?>">
创建和调用 dotenv
APP_TIMEZONE=Asia/Jakarta
getenv('APP_TIMEZONE');
使用 DataTables
在上面的 html <head>
中添加此代码
<?php table_url(); ?>
然后使用表格函数创建一个表格
table($table_title, $table_key, $table_data)
示例: 在控制器中
$data['table_title'] = 'data_table'; $data['table_key'] = ['ID', 'Category Name', 'Product Name', 'Cashier Name']; $data['table_data'] = $this->db->get('product')->result_array();
在视图中
<?php table($table_title, $table_key, $table_data); ?>
使用 Sweet Alert
notif('type','title', 'message','url');
- 类型 = ('成功','警告','信息','危险')
- URL = base_url()+URL
示例
notif('success','Login Success', 'Welcome to app','home/user');
使用 Unirest
HTTP 请求 GET
request_get($url);
HTTP 请求 POST
request_post($url, $query);
HTTP 请求 PUT
request_put($url, $query);
HTTP 请求 DELETE
request_delete($url);
示例
在您的控制器中
public function index() { // Use notif notif('success','Welcome to kubicode', 'This is the message from Home/index'); // Data for send to view $data['title'] = 'Home | Kubi Code'; $data['response'] = request_get('https://jsonplaceholder.typicode.com/todos'); // Load view $this->load->view('layouts/header',$data); $this->load->view('home/index'); $this->load->view('layouts/footer'); }
贡献
欢迎 Pull 请求。对于主要更改,请首先打开一个问题来讨论您想更改的内容。
请确保根据需要更新测试。