PHP chdir () ฟังก์ชัน
ตัวอย่าง
เปลี่ยนไดเรกทอรีปัจจุบัน:
<?php
// Get current directory
echo getcwd() . "<br>";
// Change directory
chdir("images");
// Get current directory
echo getcwd();
?>
// Get current directory
echo getcwd() . "<br>";
// Change directory
chdir("images");
// Get current directory
echo getcwd();
?>
ผล:
/home/php
/home/php/images
/home/php/images
ความหมายและการใช้งาน
chdir () ฟังก์ชันที่จะเปลี่ยนไดเรกทอรีปัจจุบัน
ไวยากรณ์
chdir( directory );
参数 | 描述 |
---|---|
directory | 必需。规定新的当前目录。 |
รายละเอียดทางเทคนิค
ผลตอบแทน: | ที่ประสบความสำเร็จกลับจริง มันล้มเหลวที่จะกลับเท็จและโยนข้อผิดพลาดระดับ E_WARNING |
---|---|
PHP รุ่น: | 4.0 ขึ้นไป |
PHP ไดเรกทอรีอ้างอิง