CI框架源码阅读,系统常量文件constants.php的配置

yipeiwu_com5年前PHP代码库
配置系统常量
1、当文件系统工作的时候检查并配置这些首选项
文件系统运行的时候这些默认的值会适当的增加系统的安全性,但是在php或apache的底层单独的为每各用户开一个进程的时候,使用八进制的值永远是正确的
FILE_READ_MODE 读取文件的模式
FILE_WRITE_MODE   写入文件的模式
DIR_READ_MODE   读取目录的模式
DIR_WRITE_MODE 写入目录的模式

 
2、文件流模式
当我们使用fopen()/popen()的时候需要这些模式
define('FOPEN_READ', 'rb');
define('FOPEN_READ_WRITE', 'r+b');
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb');
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE',  'w+b');
define('FOPEN_WRITE_CREATE', 'ab');
define('FOPEN_READ_WRITE_CREATE', 'a+b');
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT',  'x+b');

文件源码:
复制代码 代码如下:

[php] 
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 

/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------

| These prefs 控制台、首选项 are used when checking and setting modes when working
| with the file system.  The defaults are fine 罚款 on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.).  Octal values should
| always be used to set the mode correctly.

*/ 
define('FILE_READ_MODE', 0644); 
define('FILE_WRITE_MODE', 0666); 
define('DIR_READ_MODE', 0755); 
define('DIR_WRITE_MODE', 0777); 

/*
|--------------------------------------------------------------------------
| File Stream Modes 文件流模式
|--------------------------------------------------------------------------

| These modes are used when working with fopen()/popen()

*/ 

define('FOPEN_READ',                            'rb'); 
define('FOPEN_READ_WRITE',                      'r+b'); 
define('FOPEN_WRITE_CREATE_DESTRUCTIVE',        'wb'); // truncates existing file data, use with care 
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE',   'w+b'); // truncates existing file data, use with care 
define('FOPEN_WRITE_CREATE',                    'ab'); 
define('FOPEN_READ_WRITE_CREATE',               'a+b'); 
define('FOPEN_WRITE_CREATE_STRICT',             'xb'); 
define('FOPEN_READ_WRITE_CREATE_STRICT',        'x+b'); 

 
/* End of file constants.php */ 
/* Location: ./application/config/constants.php */ 

相关文章

php 友好URL的实现(吐血推荐)

友好URL的实现(吐血推荐) 大家经常看到别的站的URL是这样的吧? http://www.xxx.com/module/show/action/list/page/7 或者 http:...

php使用Jpgraph创建折线图效果示例

php使用Jpgraph创建折线图效果示例

本文实例讲述了php使用Jpgraph创建折线图效果。分享给大家供大家参考,具体如下: 在企业运营中,经常需要对各种数据进行统计,利用图表动态分析不同的数据表中的数据,可以使数据显示的更...

php5 non-thread-safe和thread-safe这两个版本的区别分析

先从字面意思上理解,None-Thread Safe就是非线程安全,在执行时不进行线程(thread)安全检查;Thread Safe就是线程安全,执行时会进行线程(thread)安全检...

2017年最新PHP经典面试题目汇总(上篇)

1、双引号和单引号的区别 双引号解释变量,单引号不解释变量 双引号里插入单引号,其中单引号里如果有变量的话,变量解释 双引号的变量名后面必须要有一个非数字、字母、下划线的特...

Ajax请求PHP后台接口返回信息的实例代码

Ajax请求PHP后台接口返回信息的实例代码

前台就是一个表单,这里是用的bootstrop的 <form method="post" > <!-- token验证 --> <!--{{ csr...