转 php 框架 Php 依赖框架

php 开发依赖框架

为了掌握这个方法,我们需要学习如下框架

https://codeigniter.org.cn/user_guide/installation/installing_composer.html#id4

https://www.ibm.com/developerworks/cn/web/wa-codeigniter/

https://www.w3cschool.cn/codeIgniter3/pbqxlozt.html

codeigniter 社区:(这个社区还是可以到额,)

 https://codeigniter.org.cn/forums/forum-code-1.html

http://www.dba.cn/book/codeigniter/

######samlpe 1

感谢yangzie1192,

--applicationcoreMY_Controller.php 

--定义着 如下内容 

--abstract class Front_Controller extends CI_Controller

Codeigniter所有的控制器都必须继承CI_Controller类,

但CI_Controller类位于system目录下,不太方便修改。

为方便做一些公用的处理,通常情况下我们会在application/core下创建MY_Controller,

用来继承CI_Controller,从而项目中所有的控制器继承MY_Controller,而不是CI_Controller;

abstract class MY_Controller extends CI_Controller

{
    function __construct()
    {     
        parent::__construct();
        
        $this->load->config('wechatconf'); //自定义配置文件
        
        $this->load->database(); //初始化数据库链接
        $this->load->library('session'); //初始化session类
        
        $this->load->helper('url'); //加载URL辅助类
        $this->load->helper('form'); //加载form辅助类
        $this->load->helper('common'); //公共辅助函数库
    
        //关闭浏览器,PHP进程依然执行
        ignore_user_abort(true);
        set_time_limit(0);
        //设置时区
        date_default_timezone_set('PRC');//'Asia/Shanghai' 亚洲/上海 ;
        header("Content-type: text/html; charset=utf-8");
    }
}

以上代码可以大致说明该类的作用;
————————————————
版权声明:本文为CSDN博主「yangzie1192」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u014471522/java/article/details/32726919

##############sample 2

C:wamp64wwwmyappapplicationlibraries

感谢 ed Jul 19 '11 at 19:46   Max Benin

Make sure to autoload model on application/config/autoload.php at line 56.

$autoload['libraries'] = array('database');


##############sample3

感谢  marlboro  

iscona
 

 https://codeigniter.org.cn/forums/thread-19043-1-1.html

applicationlibraries 配置 Layout.php   Layoutfull.php

####sample 4

感谢Dharmana

You can try this:

  1. First Load the URL Helper with:

    • $this->load->helper('url'); or set the following value in application/config/autoload.php
    • $autoload['helper'] = array('url');
  2. Then you can show the site url with:

Note: Results depends on values stored in application/config/config.php

######sample 5

感谢kissmumu

我们的template或是称之为layout的文件(layout_main.php)大致如下(简化了,实际应用中会有很多网站固定元素的):

 viewslayout_main and layout_main_full html

https://codeigniter.org.cn/forums/thread-1176-1-1.html

#####sample 6


感谢 Ali Raza

./application/config/config.php



Encryption Key
---------------------

If you use the Encryption class or the Session class you MUST set an encryption key. See the user guide for info.

$config['encryption_key'] = '02527-269-2503946-70386-34730519';





#####sample 7

感谢小亚亚啊

如何使用bootstrap

1.在CI3根目录下放js、css、img等文件夹

在view下文件的head区:

<base href="<?php echo base_url();?>" />

以后涉及到链接样式的地方就直接:

<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />


2。感谢 ChristineZ

https://www.cnblogs.com/zsnzsn/p/8416215.html

删除appliaction/.htaccess 文件 ,既可以访问 bootstrap 文件了



 

###########sample 8

感谢 file:///C:/wamp64/www/myapp/user_guide/libraries/loader.html



######
##网页端解码比较麻烦。php 决定了 存储所有数据都在数据库端,包括网页端 所有的输出和显示。
##如果你需要学习一个成品, 一条语句 往往嵌套了后台 若干张表,你不知道问题出在哪个表 ,无法学习一个简单的模块
##唯一的建议 是函数名字 一定要简单易识别



原文地址:https://www.cnblogs.com/feiyun8616/p/13179553.html