- CodeIgniter Web Application Blueprints
- Rob Foster
- 95字
- 2021-08-06 19:34:28
Creating the MY_Controller file
All projects in this book make use of the MY_Controller
file; this is the same for all projects.
Create the MY_Controller.php
file at /path/to/codeigniter/application/core/
and add the following code to it:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class MY_Controller extends CI_Controller { function __construct() { parent::__construct(); $this->load->helper('form'); $this->load->helper('url'); $this->load->helper('security'); $this->load->helper('language'); // Load language file $this->lang->load('en_admin', 'english'); } }
As you can see, we load helpers that are common to all projects, such as the form
helper and the language
helper, among others. The language file is also loaded here.
All the controllers in the project extend from this MY_Controller
file rather than the default CI_Controller
file.
推薦閱讀
- SPSS數據挖掘與案例分析應用實踐
- Effective C#:改善C#代碼的50個有效方法(原書第3版)
- Learning ArcGIS Pro 2
- 動手玩轉Scratch3.0編程:人工智能科創教育指南
- OpenCV 3和Qt5計算機視覺應用開發
- Java Web基礎與實例教程
- Oracle Database 12c Security Cookbook
- Swift細致入門與最佳實踐
- Learning R for Geospatial Analysis
- PHP+MySQL+Dreamweaver動態網站開發從入門到精通(第3版)
- JavaScript程序設計(第2版)
- Struts 2.x權威指南
- Scala Functional Programming Patterns
- Java高并發編程詳解:深入理解并發核心庫
- Keil Cx51 V7.0單片機高級語言編程與μVision2應用實踐