• ? eio_statvfs
  • eio_sync_file_range ?
  • 锟斤拷锟斤拷学院 www.cainiaoplay.com
  • PHP Manual
  • Eio 锟斤拷锟斤拷
  • Create a symbolic link

eio_symlink

(PECL eio >= 0.0.1dev)

eio_symlink — Create a symbolic link

说锟斤拷

eio_symlink ( string $path , string $new_path [, int $pri = EIO_PRI_DEFAULT [, callable $callback = NULL [, mixed $data = NULL ]]] ) : resource

eio_symlink() creates a symbolic link new_path to path.

锟斤拷锟斤拷

path

Source path

new_path

Target path

pri

锟斤拷锟斤拷锟斤拷锟斤拷燃锟斤拷锟�EIO_PRI_DEFAULT锟斤拷EIO_PRI_MIN锟斤拷EIO_PRI_MAX 锟斤拷 NULL锟斤拷锟斤拷锟斤拷锟� NULL锟斤拷pri 锟斤拷锟斤拷为 EIO_PRI_DEFAULT锟斤拷

callback

callback 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟斤拷谩锟斤拷锟接ζワ拷锟揭伙拷锟皆拷停锟�

void callback(mixed $data, int $result[, resource $req]);
data

锟斤拷锟捷革拷锟斤拷锟斤拷锟斤拷没锟斤拷锟斤拷荨锟�

result

锟斤拷锟斤拷锟斤拷锟侥斤拷锟斤拷锟街碉拷锟酵拷锟斤拷锟斤拷锟接︼拷锟较低筹拷锟斤拷梅锟斤拷氐锟街碉拷锟�

req

锟斤拷选锟斤拷锟斤拷锟斤拷锟斤拷源锟斤拷锟缴憋拷 eio_get_last_error() 之锟斤拷暮锟斤拷锟绞癸拷谩锟�

data

Arbitrary variable passed to callback.

锟斤拷锟斤拷值

eio_symlink() returns request resource on success or FALSE on error.

锟斤拷锟斤拷

Example #1 eio_symlink() example

<?php
$filename 
= dirname(__FILE__)."/symlink.dat";
touch($filename);
$link = dirname(__FILE__)."/symlink.link";

function 
my_symlink_cb($data, $result) {
    global 
$link, $filename;
    
var_dump(file_exists($data) && is_link($data));

    if (!
eio_readlink($data, EIO_PRI_DEFAULT, "my_readlink_cb", NULL)) {
        @
unlink($link);
        @
unlink($filename);
    }
}

function 
my_readlink_cb($data, $result) {
    global 
$filename, $link;
    
var_dump($result);

    @
unlink($link);
    @
unlink($filename);
}

eio_symlink($filename, $link, EIO_PRI_DEFAULT, "my_symlink_cb", $link);
eio_event_loop();
?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

bool(true)
string(16) "/tmp/symlink.dat"

锟轿硷拷

  • eio_link