chroot函数使用

PHP chroot()函数 (PHP chroot() function)

The full form of chroot is "Change Root", the function chroot()" is used to change the root directory, and, also changes the current working directory to "/".

chroot的完整格式为“ Change Root”函数chroot()“用于更改根目录,并且还将当前工作目录更改为” /“

Syntax:

句法:

    chroot(directory);

Parameter(s):

参数:

  • directory – It defines the new root directory.

    directory –它定义了新的根目录。

Return value:

返回值:

It returns a Boolean value, "TRUE" – if root directory changes successfully or "FALSE" – if root directory does not change.

如果根目录成功更改,则返回布尔值“ TRUE”;如果根目录未更改,则返回“ FALSE”。

Note:

注意:

chroot() will not work on Windows PHP installations. As per the reference manual, the function is only available on PHP when using in CLI/CGI/Embedded SAPI.

chroot()在Windows PHP安装中不起作用。 根据参考手册,仅在CLI / CGI / Embedded SAPI中使用时,该功能仅在PHP上可用。

The chroot() function requires root privileges. Please refer to the official php.net manual before attempting this function PHP chroot() function

chroot()函数需要root特权。 尝试使用此函数之前,请参考php.net官方手册PHP chroot()函数

We are not responsible in any way of any damage this function may cause.

对于此功能可能造成的任何损害,我们概不负责。

The following is a sample output of the program,

以下是程序的示例输出,

    When Success:
/
root directory is changed...
/home/folder1
When fail:
/
root directory is not changed...

Example: PHP code to change the root director

示例:更改root导演PHP代码

<?php
echo getcwd();
//making a directory
mkdir("/home/folder1");
// Change root directory
$ret_value = chroot("/home/folder1");
if($ret_value == true)
echo "root directory is changed...";
else
echo "root directory is not changed...";
// Get current directory
echo getcwd();
?>

Output

输出量

root directory is changed...
/home/folder1

Reference: PHP chroot() function

参考: PHP chroot()函数

翻译自: https://www.includehelp.com/php/chroot-function-with-example.aspx

chroot函数使用

chroot函数使用_PHP chroot()函数与示例相关推荐

  1. php 字符串函数 教程_php字符串函数 str类常见用法示例

    本文实例讲述了php字符串函数 str类常见用法.分享给大家供大家参考,具体如下: str_split(string, leg);//将一个字符 串转换为数组,参数1:要被转换的字符串,参数2:每 段 ...

  2. php函数细节_php strip_tags()函数使用注意细节

    php strip_tags()函数是去除字符串中的 HTML.XML 以及PHP的标签,返回去除标签之后的字符串,大家可以参考上一篇文章<PHP去掉HTML标签strip_tags()函数详解 ...

  3. php 字符串函数 教程_php字符串函数_PHP教程

    addslashes: 字符串加入斜线. bin2hex: 二进位转成十六进位. chop: 去除连续空白. chr: 返回序数值的字符. chunk_split: 将字符串分成小段. convert ...

  4. php 危险函数_PHP 危险函数有哪些?

    在编译 PHP 时,如无特殊需要,一定禁止编译生成 CLI 命令行模式的 PHP 解析支持.可在编译时使用 –disable-CLI.一旦编译生成 CLI 模式的PHP,则可能会被入侵者利用该程序建立 ...

  5. php中的函数调简单 传入参数即可,php函数与传递参数的简单示例

    这篇文章主要为大家详细介绍了php函数与传递参数的简单示例,具有一定的参考价值,可以用来参考一下. 感兴趣的小伙伴,下面一起跟随512笔记的小玲来看看吧! 本文实例讲述了函数的调用与函数定义语法,并讲 ...

  6. lmbs PHP,PHP的GD2函数创建折线图源码示例

    PHP的GD2函数创建折线图源码示例 代码来自 codego.net/tags/4/1/ if(!is_numeric($data[$i])) die("error id:1"); ...

  7. C++Primer:字面值常量类调用函数错误(p268书中示例报错)

    1. 背景   在阅读到C++Primer第268页时发现其示例编写好后程序报错. #include <iostream> using namespace std; class Debug ...

  8. php截取数组中的字符串,PHP 中使用explode()函数切割字符串为数组的示例

    explode()函数的作用:使用一个字符串分割另一个字符串,打散为数组. 例如: 字符串 PHP;"> $pizza = "第1 第2 第3 第4 第5 第6"; ...

  9. stl vector 函数_vector :: at()函数以及C ++ STL中的示例

    stl vector 函数 C ++ vector :: at()函数 (C++ vector::at() function) vector::at() is a library function o ...

最新文章

  1. c++ primer plus 学习笔记
  2. FPGA篇(五)Capture导出FPGA引脚分配和端口定义
  3. matlab平面问题编程,有限元平面矩形单元MATLAB程序设计.docx
  4. display详细说明
  5. IDEA:将web工程部署到tomcat
  6. java开发项目实例_Alibaba内部出品Java突击手册,大量开发实战项目分享
  7. WPF 之 鼠标双击事件
  8. decimal(10,2) 的含义
  9. c语言解析sql语句_解析SQL语句比解析类C语言更麻烦?
  10. 苹果手机录屏软件_手机端录屏软件哪个好 手机上最好的录屏软件
  11. ubuntu下载安装nginx+nginx-rtmp-module
  12. dbfs和dbm的换算_dB 、dBm、dBuv的概念及换算
  13. 软件工程师是青春饭吗?
  14. 嵌入式Linux开发常用命令总结
  15. spark sql boardcast join 生效问题探索
  16. 计算机word文档无法预览,电脑打开Word文档内容显示不全或显示空白怎么解决
  17. apache httpclient 连接 IIB,发送XML请求
  18. [渝粤教育] 天水师范学院 移动通信与无线网络 参考 资料
  19. 一文速学数模-时序预测模型(四)二次指数平滑法和三次指数平滑法详解+Python代码实现
  20. SAXReader简单的解析xml文件

热门文章

  1. 和push的区别_还没有理解let 和 const的用法和区别吗,几百字让你立马搞懂
  2. MIP开发教程(三) 使用MIP-CLI工具调试组件
  3. node+socket.io 实现一个聊天室
  4. “云”上存储初显规模 如何架构是关键
  5. GATK之VariantAnnotator
  6. 服务器搭建-Linux基础知识
  7. atitit.atiOrmStoreService 框架的原理与设计 part1  概述与新特性
  8. 关于grep,egrep正则表达式的常用用法
  9. netapp存储常用命令
  10. Linux卸载Mysql