PHP chdir Change Directory function tutorial

Source: Internet
Author: User

ChDir-Change Directory

Describe
Boolean chdir (string $ directory)
Change the directory for the current directory of PHP.

Parameters

Directory
The new current directory


return value
Returns TRUE or false success failure.

Instance

Example of # 1 chdir ()

<?php

Current directory
Echo GETCWD (). "N";

ChDir (' public_html ');

Current directory
Echo GETCWD (). "N";

?>

$path = "C:temp";
ChDir ($path);
GETCWD ()
Gives you "C:temp"

$path = "C:temp";
ChDir ($path);
GETCWD ()
Gives you "C:temp"

To work around this inconsistency
Doing a chdir ('. ') after the chdir always gives back "c:temp"

The example above will output similar to the following:

/Home/Article
/home/text/public_html

Note
Note: If Safe mode is activated, PHP will check whether the directory of the script operation has the same UID (owner) script that is being executed.

See again

GETCWD ()-Get current working directory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.