配置系统常量
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怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号