phdfsHDFS 的 PHP 扩展
Phdfs 是hadoop hdfs 的php扩展。用于便捷的操作HDFS。
<?php
try {
$obj = new phdfs(“127.0.0.1“,”9000“);
$obj->connect();
//create file
$log = $obj->write("/a/b/c/test1.txt","test",O_WRONLY|O_CREAT);
//appden file
$log = $obj->write("/a/b/c/test2.txt","test",O_WRONLY|O_APPEND);
var_dump($log);
echo $obj->rename("/a/b/c/test2.txt","/a/b/c/test3.txt");
}catch (Exception $ex) {
echo $ex->getMessage();
}
?>
评论