无需言 做自己 业 ,精于勤 荒于嬉.
- Session 函数 session_cache_limiter 读取/设置缓存限制器
-
发表日期:2021-07-01 08:56:51 | 来源: | 分类:Session 函数
-
示例1
<?php /* 设置缓存限制器为 'private' */ session_cache_limiter('private'); $cache_limiter = session_cache_limiter(); echo "The cache limiter is now set to $cache_limiter<br />"; ?>
- Session 函数 session_reset Re-initialize session array with original values
-
发表日期:2021-07-01 08:56:51 | 来源: | 分类:Session 函数
-
session_reset
(PHP 5 >= 5.6.0, PHP 7, PHP 8)
session_reset — Re-initialize session array with original values
说明
session_reset(): boolsession_reset() reinitializes a session with original values stored in session storage. This function requires an active session and discards changes in $_SESSION.
参数
此函数没有参数。
返回值
成功时返回
true, 或者在失败时返回false。更新日志
版本 说明 7.2.0 The return type of this function is bool now. Formerly, it has been void. 参见
- $_SESSION
- The session.auto_start configuration directive
- session_start() - 启动新会话或者重用现有会话
- session_abort() - Discard session array changes and finish session
- session_commit() - session_write_close 的别名
- Session 函数 session_set_save_handler 设置用户自定义会话存储函数
-
发表日期:2021-07-01 08:56:51 | 来源: | 分类:Session 函数
-
示例1
<?php class MySessionHandler implements SessionHandlerInterface{ // 在这里实现接口} $handler = new MySessionHandler(); session_set_save_handler($handler, true); session_start(); // 现在可以使用 $_SESSION 保存以及获取数据了
- Session 函数 session_status 返回当前会话状态
-
发表日期:2021-07-01 08:56:51 | 来源: | 分类:Session 函数
-
session_status
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
session_status — 返回当前会话状态
说明
session_status(): intsession_status() 被用于返回当前会话状态。
返回值
-
PHP_SESSION_DISABLED会话是被禁用的。 -
PHP_SESSION_NONE会话是启用的,但不存在当前会话。 -
PHP_SESSION_ACTIVE会话是启用的,而且存在当前会话。
参见
- session_start() - 启动新会话或者重用现有会话
-
- Session 函数 session_set_cookie_params 设置会话 cookie 参数
-
发表日期:2021-07-01 08:56:51 | 来源: | 分类:Session 函数
-
- Session 函数 session_unset 释放所有的会话变量
-
发表日期:2021-07-01 08:56:51 | 来源: | 分类:Session 函数
-
session_unset
(PHP 4, PHP 5, PHP 7, PHP 8)
session_unset — 释放所有的会话变量
说明
session_unset(): voidsession_unset() 会释放当前会话注册的所有会话变量。
返回值
没有返回值。
- Session 函数 session_abort Discard session array changes and finish session
-
发表日期:2021-07-01 08:56:50 | 来源: | 分类:Session 函数
-
session_abort
(PHP 5 >= 5.6.0, PHP 7, PHP 8)
session_abort — Discard session array changes and finish session
说明
session_abort(): boolsession_abort() finishes session without saving data. Thus the original values in session data are kept.
参数
此函数没有参数。
返回值
成功时返回
true, 或者在失败时返回false。更新日志
版本 说明 7.2.0 The return type of this function is bool now. Formerly, it has been void. 参见
- $_SESSION
- The session.auto_start configuration directive
- session_start() - 启动新会话或者重用现有会话
- session_reset() - Re-initialize session array with original values
- session_commit() - session_write_close 的别名
- Session 函数 session_create_id Create new session id
-
发表日期:2021-07-01 08:56:50 | 来源: | 分类:Session 函数
-
示例1
<?php // My session start function support timestamp managementfunction my_session_start() { session_start(); // Do not allow to use too old session ID if (!empty($_SESSION['deleted_time']) && $_SESSION['deleted_time'] < time() - 180) { session_destroy(); session_start(); } } // My session regenerate id functionfunction my_session_regenerate_id() { // Call session_create_id() while session is active to // make sure collision free. if (session_status() != PHP_SESSION_ACTIVE) { session_start(); } // WARNING: Never use confidential strings for prefix! $newid = session_create_id('myprefix-'); // Set deleted timestamp. Session data must not be deleted immediately for reasons. $_SESSION['deleted_time'] = time(); // Finish session session_commit(); // Make sure to accept user defined session ID // NOTE: You must enable use_strict_mode for normal operations. ini_set('session.use_strict_mode', 0); // Set new custom session ID session_id($newid); // Start with custom session ID session_start(); } // Make sure use_strict_mode is enabled.// use_strict_mode is mandatory for security reasons.ini_set('session.use_strict_mode', 1); my_session_start(); // Session ID must be regenerated when// - User logged in// - User logged out// - Certain period has passedmy_session_regenerate_id(); // Write useful codes?>
- Session 函数 session_cache_expire 返回当前缓存的到期时间
-
发表日期:2021-07-01 08:56:50 | 来源: | 分类:Session 函数
-
示例1
<?php /* 设置缓存限制为 “private” */ session_cache_limiter('private'); $cache_limiter = session_cache_limiter(); /* 设置缓存过期时间为 30 分钟 */ session_cache_expire(30); $cache_expire = session_cache_expire(); /* 开始会话 */ session_start(); echo "The cache limiter is now set to $cache_limiter<br />"; echo "The cached session pages expire after $cache_expire minutes"; ?>
- Session 函数 session_decode 解码会话数据
-
发表日期:2021-07-01 08:56:50 | 来源: | 分类:Session 函数
-
session_decode
(PHP 4, PHP 5, PHP 7, PHP 8)
session_decode — 解码会话数据
说明
session_decode(string$data): boolsession_decode() 对
$data参数中的已经序列化的会话数据进行解码, 并且使用解码后的数据填充 $_SESSION 超级全局变量。请注意,这里的反序列化方法不同于 unserialize() 函数。 序列化方法是 PHP 内置的,并且可以通过 session.serialize_handler 配置项进行修改。
参数
-
data -
编码后的数据
返回值
成功时返回
true, 或者在失败时返回false。 -
- FTP 函数 ftp_nlist 返回给定目录的文件列表
-
发表日期:2021-07-01 08:56:47 | 来源: | 分类:FTP 函数
-
示例1
<?php // set up basic connection$conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connectionif ((!$conn_id) || (!$login_result)) { die("FTP connection has failed !"); } // get contents of the root directory$contents = ftp_nlist($conn_id, "/"); // output $contentsvar_dump($contents); ?>
- FTP 函数 ftp_pasv 返回当前 FTP 被动模式是否打开
-
发表日期:2021-07-01 08:56:47 | 来源: | 分类:FTP 函数
-
示例1
<?php $file = 'somefile.txt'; $remote_file = 'readme.txt'; // set up basic connection$conn_id = ftp_connect($ftp_server); // login with username and password$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // turn passive mode onftp_pasv($conn_id, true); // upload a fileif (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) { echo "successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } // close the connectionftp_close($conn_id); ?>
- FTP 函数 ftp_pwd 返回当前目录名
-
发表日期:2021-07-01 08:56:47 | 来源: | 分类:FTP 函数
-
示例1
<?php // set up basic connection$conn_id = ftp_connect($ftp_server); // login with username and password$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // change directory to public_htmlftp_chdir($conn_id, 'public_html'); // print current directoryecho ftp_pwd($conn_id); // /public_html// close the connectionftp_close($conn_id); ?>
- FTP 函数 ftp_put 上传文件到 FTP 服务器
-
发表日期:2021-07-01 08:56:47 | 来源: | 分类:FTP 函数
-
示例1
<?php $file = 'somefile.txt'; $remote_file = 'readme.txt'; // set up basic connection$conn_id = ftp_connect($ftp_server); // login with username and password$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // upload a fileif (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) { echo "successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } // close the connectionftp_close($conn_id); ?>
- FTP 函数 ftp_raw 向 FTP 服务器发送命令
-
发表日期:2021-07-01 08:56:47 | 来源: | 分类:FTP 函数
-
示例1
<?php $fp = ftp_connect("ftp.example.com"); /* 等同于 ftp_login($fp, "joeblow", "secret"); */ ftp_raw($fp, "USER joeblow"); ftp_raw($fp, "PASS secret"); ?>
- FTP 函数 ftp_quit ftp_close() 的 别名
-
发表日期:2021-07-01 08:56:47 | 来源: | 分类:FTP 函数
-
说明
此函数是该函数的别名: ftp_close()
- FTP 函数 ftp_set_option 设置各种 FTP 运行时选项
-
发表日期:2021-07-01 08:56:47 | 来源: | 分类:FTP 函数
-
示例1
<?php // 设置网络传输超时时间为 10 秒ftp_set_option($conn_id, FTP_TIMEOUT_SEC, 10); ?>
- FTP 函数 ftp_nb_continue 连续获取/发送文件(以不分块的方式 non-blocking)
-
发表日期:2021-07-01 08:56:47 | 来源: | 分类:FTP 函数
-
示例1
<?php // Initiate the download$ret = ftp_nb_get($my_connection, "test", "README", FTP_BINARY); while ($ret == FTP_MOREDATA) { // Continue downloading... $ret = ftp_nb_continue($my_connection); } if ($ret != FTP_FINISHED) { echo "There was an error downloading the file..."; exit(1); } ?>
- FTP 函数 ftp_rename 更改 FTP 服务器上的文件或目录名
-
发表日期:2021-07-01 08:56:47 | 来源: | 分类:FTP 函数
-
示例1
<?php $old_file = 'somefile.txt.bak'; $new_file = 'somefile.txt'; // set up basic connection$conn_id = ftp_connect($ftp_server); // login with username and password$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to rename $old_file to $new_fileif (ftp_rename($conn_id, $old_file, $new_file)) { echo "successfully renamed $old_file to $new_file\n"; } else { echo "There was a problem while renaming $old_file to $new_file\n"; } // close the connectionftp_close($conn_id); ?>
- FTP 函数 ftp_rawlist 返回指定目录下文件的详细列表
-
发表日期:2021-07-01 08:56:47 | 来源: | 分类:FTP 函数
-
示例1
<?php // 初始化连接$conn_id = ftp_connect($ftp_server); // 使用用户名和密码登录$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // 获取 / 路径下的文件列表$buff = ftp_rawlist($conn_id, '/'); // 关闭连接ftp_close($conn_id); // 输出var_dump($buff); ?>
- 前端开发(1)
- 数据库(0)
- PHP(0)
- PHP杂项(34)
- PHP基础-李炎恢系列课程(20)
- 中文函数手册(0)
- 错误处理 函数(13)
- OPcache 函数(6)
- PHP 选项/信息 函数(54)
- Zip 函数(10)
- Hash 函数(15)
- OpenSSL 函数(63)
- Date/Time 函数(51)
- 目录函数(9)
- Fileinfo 函数(6)
- iconv 函数(11)
- 文件系统函数(81)
- 多字节字符串 函数(57)
- GD 和图像处理 函数(114)
- 可交换图像信息(5)
- Math 函数(50)
- 程序执行函数(11)
- PCNTL 函数(23)
- JSON 函数(4)
- SPL 函数(15)
- URL 函数(10)
- cURL 函数(32)
- 网络 函数(33)
- FTP 函数(36)
- Session 函数(23)
- PCRE 函数(11)
- PCRE 正则语法(19)
- 数组 函数(81)
- 类/对象 函数(18)
- 函数处理 函数(13)
- 变量处理 函数(37)
- SimpleXML 函数(3)
- 杂项 函数(31)
- 字符串 函数(101)
- JAVA(0)
- Android(0)
- Linux(0)
- AI大模型(9)
- 其他(0)
宁公网安备 64010402001209号