Skip to content
Discussion options

You must be logged in to vote

编辑模式麻烦很多~在alist中,实现的意义不大,我情愿下载后编辑。不过后来发现有一个好处,就是能共同编辑。某些情况下,这个功能很好用!
编辑模式除了需要edit.html外,还需要配置一个回调处理程序 详细可参阅https://api.onlyoffice.com/zh/editors/callback。我自己用到是PHP。

callback.php

<?php

if (($body_stream = file_get_contents("php://input"))===FALSE){
    echo "Bad Request";
}

$data = json_decode($body_stream, TRUE);

if ($data["status"] == 2){
    $downloadUri = $data["url"];
        
    if (($new_data = file_get_contents($downloadUri))===FALSE){
        echo "Bad Response";
    } else {
        file_put_contents($path_for_save, $new_data, LOCK_EX);
    }
}
echo "{\"error\":0}";

?>

edit.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>OnlyOffice editor<…

Replies: 5 comments 15 replies

Comment options

You must be logged in to vote
5 replies
@zhushen12580
Comment options

@zhushen12580
Comment options

@homuraLan
Comment options

@zhushen12580
Comment options

@homuraLan
Comment options

Answer selected by zhushen12580
Comment options

You must be logged in to vote
1 reply
@homuraLan
Comment options

Comment options

You must be logged in to vote
1 reply
@homuraLan
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@anwen-anyi
Comment options

@imysl0
Comment options

@imysl0
Comment options

@imysl0
Comment options

@Li-Aaron
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
10 participants